zend-http-client

Content type-error when using Zend_Http_Client

守給你的承諾、 提交于 2020-01-03 10:26:07
问题 I'm trying to send data to Google Analytic's collector with Zend_Http_Client and POST. I have an array $postParams that's including my tracking-ID, cid and hit types and I add the values of this array to my client via setParameterPost() . Here's the relevant part of my Action: $client = new Zend_Http_Client('https://ssl.google-analytics.com/debug/collect'); foreach ($postParams as $postParam => $postValue) { $client->setParameterPost($postParam, $postValue); } $response = $client->request();

How to emulate POSTing multiple checkbox form fields myField[] with Zend_Http_Client?

家住魔仙堡 提交于 2019-12-22 18:29:26
问题 I am using Zend_Http_Client to POST a set of data to my server running PHP. However, the server is expecting data in the form myField[] , i.e. I have a set of check boxes and the user can check more than one. My current code is: foreach ($myValues as $value) { $this->client->setParameterPost('myField[]', $value); } However, it seems that Zend_Http_Client is simply overwriting myField[] with the new value each time it goes through the loop. How can I add multiple POST fields of the same name

Zend_HTTP_Client wont let me POST any data

不羁的心 提交于 2019-12-21 16:24:13
问题 I have been searching all over stackoverflow and Google for a solution to my problem. I have created two projects with Zend Framework - Project1 and Project2 - and I want to implement web services on one of them. The idea is to send a JSON-string to Project1 and receive back a JSON with all the details associated with that variable using POST. Now I have created a TestController on Project2 : public function indexAction(){ $uri = 'http://project1.com/WebService/data'; $config = array(

authentication using Zend_Http_Client

我只是一个虾纸丫 提交于 2019-12-12 09:48:31
问题 I'm trying to use Zend_Http_Client to make a simple post request on a site that requires authentication. Everything seems to be correct but I'm still getting a You are not authorized to view this page error. Any ideas what the problem might be? I'm certain the username and password are correct $client = new \Zend_Http_Client('http://ncmcrm/sales_summary/activity_range.asp'); $client->setHeaders('WWW-Authenticate', 'Negotiate'); $client->setParameterPost(array( 'from_day' => 1, 'from_month' =>

Zend HTTP Client Invalid URI?

China☆狼群 提交于 2019-12-11 17:47:15
问题 I'm having trouble using Zend HTTP on a URL: $client = new Zend_Http_Client('http://xxfire_killumiex.api.channel.livestream.com/2.0/info.json'); $feed = $client->request()->getBody(); For some reason, this gives me an error... Invalid URI supplied Whats wrong this this specific url? 回答1: Whats wrong this this specific url? The underscore. From RFC 1912 Allowable characters in a label for a host name are only ASCII letters, digits, and the `-' character. Edit After doing some more reading, it

Zend_Http_Client POST 'missing required parameters'

谁说胖子不能爱 提交于 2019-12-11 15:57:44
问题 First of all, I looked at this question and tried the solution, did not work for me. I am working in Zend 1.12 on a PHP 7.0.22 server. I have a function that should post data to an API and receive a confirmation of the post. Whenever I test it in my rest client, in firefox, I get this response from the API call: "{\"code\":400,\"text\":\"Missing required parameters.\"}" . When I add a header: Content-Type: application/x-www-form-urlencoded I get the expected respone: '200, true' . But even

How get a valid JSON output from the response in Zend Framework 3?

家住魔仙堡 提交于 2019-12-11 04:46:31
问题 I'm writing a client for an API... use Zend\Http\Client; use Zend\Http\Request; use Zend\Json\Json; ... $request = new Request(); $request->getHeaders()->addHeaders([ 'Accept-Charset' => 'UTF-8', 'Accept' => 'application/hal+json', 'Content-Type' => 'application/hal+json; charset=UTF-8', ]); $apiAddress = 'http://my.project.tld/categories'; $request->setUri($apiAddress); $request->setMethod('GET'); $client = new Client(); $response = $client->dispatch($request); $data = $response->getContent(

How to emulate POSTing multiple checkbox form fields myField[] with Zend_Http_Client?

风格不统一 提交于 2019-12-06 06:13:29
I am using Zend_Http_Client to POST a set of data to my server running PHP. However, the server is expecting data in the form myField[] , i.e. I have a set of check boxes and the user can check more than one. My current code is: foreach ($myValues as $value) { $this->client->setParameterPost('myField[]', $value); } However, it seems that Zend_Http_Client is simply overwriting myField[] with the new value each time it goes through the loop. How can I add multiple POST fields of the same name using Zend_Http_Client? UPDATE I have actually figured out a way to do this, by hacking the Zend_Http

Zend_HTTP_Client wont let me POST any data

痞子三分冷 提交于 2019-12-04 07:26:36
I have been searching all over stackoverflow and Google for a solution to my problem. I have created two projects with Zend Framework - Project1 and Project2 - and I want to implement web services on one of them. The idea is to send a JSON-string to Project1 and receive back a JSON with all the details associated with that variable using POST. Now I have created a TestController on Project2 : public function indexAction(){ $uri = 'http://project1.com/WebService/data'; $config = array( 'adapter' => 'Zend_Http_Client_Adapter_Curl', 'curloptions' => array(CURLOPT_FOLLOWLOCATION => true), );