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 ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Zend_Http_Client ” 77<br />
// All cookies for the domain localhost.example <strong>with</strong> a path or<br />
// subpath of /some/path<br />
$cookies = $cookiejar->getMatchingCookies(<br />
’http://localhost.example/some/path’<br />
);<br />
// All non-session cookies for the domain localhost.example<br />
$cookies = $cookiejar->getMatchingCookies(<br />
’http://localhost.example/’,<br />
false<br />
);<br />
?><br />
Alternatively, getAllCookies can be used <strong>to</strong> access all cookies contained in the cookie<br />
jar instance. When a cookie jar is only used <strong>to</strong> s<strong>to</strong>re cookies for a single domain,<br />
getAllCookies offers a more concise method than getMatchingCookies <strong>to</strong> retrieve all<br />
cookies for that domain. Like getMatchingCookies, getAllCookies also returns an array<br />
of Zend_Http_Cookie objects by default.<br />
R edir ection<br />
The maxdirects configuration setting is an integer indicating the maximum number<br />
of redirections <strong>to</strong> perform before terminating. U pon termination, the client<br />
will simply return the last response it received. The isRedirect method of<br />
Zend_Http_Response returns true for responses <strong>with</strong> a 300-level status code.<br />
Sections 10.3.2 and 10.3.3 of RFC 2616 indicate that when a redirection occurs,<br />
both the request method and parameters should be retained. In practice, most<br />
clients don’t behave this way. Instead, parameters are cleared and the method reverts<br />
<strong>to</strong> GET. F or consistency <strong>with</strong> other clients, Zend_Http_Client behaves this way<br />
by default. To force it <strong>to</strong> be compliant <strong>with</strong> the RFC, the strictredirects configuration<br />
setting can be set <strong>to</strong> true.<br />
U ser Agents<br />
The useragent configuration setting contains the user agent string <strong>to</strong> use and defaults<br />
<strong>to</strong> ’Zend_Http_Client’.