11.5. Fetching a URL with Headers11.5.1. ProblemYou want to retrieve a URL that requires specific headers to be sent with the request for the page. 11.5.2. SolutionUse the cURL extension and the CURLOPT_HTTPHEADER option:
If cURL isn't available, use the addHeader( ) method in HTTP_Request:
11.5.3. DiscussioncURL has special options for setting the Referer and User-Agent request headers — CURLOPT_REFERER and CURLOPT_USERAGENT:
11.5.4. See AlsoRecipe 11.14 explains why "referrer" is often misspelled "referer" in web programming contexts; documentation on curl_setopt( ) at http://www.php.net/curl-setopt; the PEAR HTTP_Request class at http://pear.php.net/package-info.php?package=HTTP_Request.
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|