Edit report at https://bugs.php.net/bug.php?id=64016&edit=1
ID: 64016
Comment by: mattsch at gmail dot com
Reported by: anil at saog dot net
Summary: file_get_contents does not fill up
$http_response_header via HEAD method
Status: Open
Type: Bug
Package: *URL Functions
Operating System: Centos 6.2
PHP Version: 5.4.11
Block user comment: N
Private report: N
New Comment:
$http_response_header is undefined after doing a file_get_contents on a url on
php 5.3.21 as well.
Previous Comments:
------------------------------------------------------------------------
[2013-01-18 11:19:42] anil at saog dot net
Description:
------------
PHP is compiled with option "--with-curlwrappers". Whenever a HEAD request
issued with "file_get_contents", "$http_response_header" is not filled-up but
upon calling "get_headers()", variable "$http_response_header" auto-magically
filled up.
Test script:
---------------
$url = 'http://www.google.com';
$ctx = stream_context_create();
stream_context_set_option($ctx, array('http' => array('method' =>
'HEAD','timeout' => 60)));
$res = file_get_contents($url, false, $ctx);
var_dump($http_response_header); // NULL
get_headers($url);
var_dump($http_response_header); // filled up correctly
Expected result:
----------------
"$http_response_header" filled-up correctly
Actual result:
--------------
"$http_response_header" is always NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64016&edit=1