note 71226 added to wrappers.http
| From: | dwalton at acm dot org | Date: | Fri, 17 Nov 2006 08:18:39 +0000 |
| Subject: | note 71226 added to wrappers.http | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119829@lists.php.net to get a copy of this message | ||
As it says on this page:
"The stream allows access to the body of the resource; the headers are stored in the
$http_response_header variable. Since PHP 4.3.0, the headers are available using
stream_get_meta_data()."
This one sentence is the only documentation I have found on the mysterious $http_response_header
variable, and I'm afraid it's misleading. It implies that from 4.3.0 onward,
stream_get_meta_data() ought to be used in favor of $http_response_header.
Don't be fooled! stream_get_meta_data() requires a stream reference, which makes it ONLY
useful with fopen() and related functions. However, $http_response_header can be used to get the
headers from the much simpler file_get_contents() and related functions, which makes it still very
useful in 5.x.
Also note that even when file_get_contents() and friends fail due to a 4xx or 5xx error and return
false, the headers are still available in $http_response_header.
----
Server IP: 66.163.161.117
Probable Submitter: 68.122.11.183
----
Manual Page -- http://www.php.net/manual/en/wrappers.http.php
Edit -- https://master.php.net/note/edit/71226
Del: integrated -- https://master.php.net/note/delete/71226/integrated
Del: useless -- https://master.php.net/note/delete/71226/useless
Del: bad code -- https://master.php.net/note/delete/71226/bad+code
Del: spam -- https://master.php.net/note/delete/71226/spam
Del: non-english -- https://master.php.net/note/delete/71226/non-english
Del: in docs -- https://master.php.net/note/delete/71226/in+docs
Del: other reasons-- https://master.php.net/note/delete/71226
Reject -- https://master.php.net/note/reject/71226
Search -- https://master.php.net/manage/user-notes.php