Debugging

The last request sent by the client can be obtained in the form of a string via its getLastRequest method. For the last response received, the corresponding method getLastResponse can be called. This returns an instance of Zend_Http_Response rather than a string. To convert this object to a string, call its asString method. See below for examples of both.

<?php
$requestString = $client->getLastRequest();
$responseObject = $client->getLastResponse();
$responseString = $responseObject->asString();
?>

Note that the storeresponse configuration setting affects how getLastResponse behaves. When set to true (the default), it causes the last response received by the client to be stored for later retrieval. When it is set to false, the response is not stored and is only available as the return value of the client’s request method. fn this case, getLastResponse would return null. If you don't needed the additional availability of the response, turning this off can lessen resource usage.

 


© Zend_Http_Client — Web Scraping

>>> Back to TABLE OF CONTENTS <<<
Category: Article | Added by: Marsipan (01.09.2014)
Views: 403 | Rating: 0.0/0
Total comments: 0
avatar