Responses

The response returned by the client’s request method has a number of useful accessor methods.

<?php
// Returns an integer containing the status code var_dump($response->getStatus());

// Returns a string containing a description for the status code var_dump($response->getMessage());

// Returns a string containing the fully decoded response body var_dump($response->getBody());

// Returns a string containing the unaltered response body var_dump($response->getRawBody());

// Returns an associative array of headers var_dump($response->getHeaders ());

// Returns a string or array of values for a single header var_dump($response->getHeader('Content-Type'));

// Returns TRUE for 100- and 200-level status codes
var_dump($response->isSuccessul());

// Returns TRUE for 400- and 500-level status codes
var_dump($response->isError());
?>

© Zend_Http_Client — Web Scraping

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