English 中文(简体)
利用Zentd_http://Client_
原标题:Getting Response Body using Zend_http_Client

我很想说的是,一架载有以下法典的《教育、预算内方案部分、执行情况监测和评价方法条例和细则》。

$client = new Zend_Http_Client();
$client->setMethod(Zend_Http_Client::POST);
$client->setUri( http://www.example.com/api/type/ );
$client->setParameterPost(array(
     useremail   =>  ******@*****.*** ,
     apikey    =>  secretkey ,
     description  =>  TEST WEB API ,
     amount    =>  5000.00 
    ));

然而,我要获得header Value-(201)Response Body,这两条在处决后交还。

我如何这样做?

最佳回答

我假定你通过下列方式实际执行请求:

$response = $client->request();

此时此刻,你们的所有需要都是用美元回答的物体。

//Dump headers
print_r($response->headers);

//Dump body
echo $response->getBody();

Refer to the Zend_Http_Response docs at:

http://framework.zend.com/apidoc/1.10/

更多可用方法。

问题回答

......

 $client->setUri ( $image_source_urls );
 $response = $client->request (  GET  );
 $folder_content = $response->getBody ();




相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...

热门标签