Problem with $http_response_header

From: Date: Thu, 10 Apr 2003 11:18:26 +0000
Subject: Problem with $http_response_header
Groups: php.general 
Request: Send a blank email to php-general+get-143313@lists.php.net to get a copy of this message
Hi, when using fopen() to open an URL, it seems that with PHP 4.3.x $http_response_header is empty if the server responds with a 4xx or 5xx status. <?php $fp = fopen('http://localhost/no-such-file.txt', 'r'); print_r($http_response_header); ?> With PHP 4.2.3 I get b>Warning</b>:fopen("http://localhost/no-such-file.txt", b>"r") - Network is unreachable in <b>/home/errath/packages/php-4.2.3/test.php</b> on line <b>3</b><br /> 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 ( ) Any ideas? TIA, Max

« previous php.general (#143313) next »