#23152 [Asn->Csd]: $http_response_header is empty if server responds with a 4xx/5xx status

From: Date: Mon, 14 Apr 2003 13:57:01 +0000
Subject: #23152 [Asn->Csd]: $http_response_header is empty if server responds with a 4xx/5xx status
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37644@lists.php.net to get a copy of this message
ID: 23152 Updated by: iliaa@php.net Reported By: maximilian dot errath at uni-graz dot at -Status: Assigned +Status: Closed Bug Type: HTTP related Operating System: Solaris 8 PHP Version: 4.3.1 Assigned To: iliaa New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-04-10 09:35:53] maximilian dot errath at uni-graz dot at When using fopen() to open an URL, $http_response_header is empty if the server responds with a 4xx or 5xx status. My script: <?php $fp = fopen('http://localhost/no-such-file.txt', 'r'); print_r($http_response_header); ?> With PHP 4.2.3 I get Warning:fopen("http://localhost/no-such-file.txt", "r") - Network is unreachable in /home/errath/packages/php-4.2.3/test.php on line 3 Array ( [0] => HTTP/1.1 404 Not Found [1] => Date: Thu, 10 Apr 2003 10:06:38 GMT [2] => Server: Apache/1.3.23 (Unix) [3] => Connection: close [4] => Content-Type: text/html; charset=iso-8859-1 ) but with PHP 4.3.1 and 4.3.2RC1 I get: Warning: fopen(http://localhost/no-such-file.txt) [http://www.php.net/function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/errath/packages/php-4.3.2RC1/test.php on line 3 Array ( ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23152&edit=1

« previous php.bugs (#37644) next »