php|architect's Guide to Web Scraping with PHP - Wind Business ...
php|architect's Guide to Web Scraping with PHP - Wind Business ...
php|architect's Guide to Web Scraping with PHP - Wind Business ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
PEAR::HTTP_Client ” 63<br />
• sendRequest intuitively dispatches the request and obtains the response. It returns<br />
either true <strong>to</strong> indicate that that request succeeded or an error object (of<br />
the PEAR_Error class by default) if an issue occurred.<br />
Issues that cause errors include environmental requirements of the component not<br />
being met or the target of the request exceeding the redirect limit. PEAR::isError is<br />
used <strong>to</strong> determine if the sendRequest call resulted in an error. If the request is sent<br />
successfully, several methods of the request object are available <strong>to</strong> extract response<br />
information.<br />
<br />
H ere are a few specifics about the response information methods.<br />
• getResponseCode returns an integer containing the HTTP status code.<br />
• getResponseReason returns a string containing a description that corresponds<br />
<strong>to</strong> the HTTP status code.<br />
• getResponseCookies returns false if no cookies are set; otherwise it returns an<br />
enumerated array of associative arrays each of which contains information for<br />
an individual cookie such as its name, value, and expiration date.<br />
• getResponseHeader will return an associative array of all headers indexed by<br />
header name (in all lo wercase) if no parameter is passed <strong>to</strong> it; otherwise, it<br />
takes a single string parameter containing a specific header name for which it<br />
will return the value.<br />
sendRequest does not modify any parameters set by you that are specific <strong>to</strong> the request<br />
(as opposed <strong>to</strong> the response). That is, request instances can be reused and