note 76416 deleted from function.get-headers by danbrown
| From: | danbrown@php.net | Date: | Mon, 09 Jan 2012 19:59:37 +0000 |
| Subject: | note 76416 deleted from function.get-headers by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185498@lists.php.net to get a copy of this message | ||
Note Submitter: angelo [at] mandato (dot) com
----
Be forewarned, none of the get_headers() functions below will replicate the behavior of PHP 5's
get_headers() for URLs that use the 'Location:' redirect header or return File Not Found
headers.
According to RFC1945, A user agent should never automatically redirect a request more than 5 times,
since such redirections usually indicate an infinite loop. For true compatibility, the functions
below should be able to handle up to 5 Location redirects within one function call. Only the native
get_headers() function exhibits this behavior. None of the functions below handle the
'Location' redirection.
The native PHP >= 5 get_headers() function will not return headers in some instances where the
functions below would. For example, if the server returns a 404 status, get_headers() will throw a
PHP warning. Unfortunately, the 404 error can only be known by looking at the headers. From first
glance, all of the functions below will return 404 headers, which may be a desired effect but does
not replicate the behavior of the native get_headers() function.