#19109 [Opn->Bgs]: $http_response_header from fopen() is incomplete

From: Date: Mon, 26 Aug 2002 16:33:51 +0000
Subject: #19109 [Opn->Bgs]: $http_response_header from fopen() is incomplete
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17876@lists.php.net to get a copy of this message
ID: 19109 Updated by: iliaa@php.net Reported By: jagrant@gsc.nrcan.gc.ca -Status: Open +Status: Bogus Bug Type: HTTP related Operating System: SunOS nrn1 5.8 Generic_108528-12 PHP Version: 4.2.2 New Comment: Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Thank you for your interest in PHP. Lynx sends a completely different request then php's fopen(). First of all adding the -head flag makes lynx send a HEAD not a GET request meaning that only the headers are requested. Lynx also sends 3 headers pertaining to the kind of data it can accept, which is quite likely what is promting the web server on atlas.gc.ca to send additional headers. It is also quite likely that that site, attempts some sort of browser detection and sends different headers depending on the browser. Previous Comments: ------------------------------------------------------------------------ [2002-08-26 11:56:18] jagrant@gsc.nrcan.gc.ca fopen() documentation states that $http_response_header will contain the header entities. It seems to work for most URLs, but is incomplete for others. Test URL: http://atlas.gc.ca/site/english/index.html 1. test code: $f=@fopen("http://atlas.gc.ca/site/english/index.html','r'); if($f){ print_r($http_response_header); fclose($f); } gives this output: Array ( [0] => HTTP/1.0 200 OK [1] => Date: Mon, 26 Aug 2002 15:47:17 GMT [2] => Server: Apache/1.3.26 (Unix) mod_fastcgi/2.2.12 [3] => X-Powered-By: Zope (www.zope.org), Python (www.python.org) [4] => Content-Length: 24612 [5] => Content-Type: text/html [6] => X-Cache: MISS from atlas.gc.ca [7] => Connection: close ) 2. but lynx -dump -head http://atlas.gc.ca/site/english/index.html returns a more detailed response: HTTP/1.0 200 OK Date: Mon, 26 Aug 2002 15:25:10 GMT Server: Apache/1.3.26 (Unix) mod_fastcgi/2.2.12 X-Powered-By: Zope (www.zope.org), Python (www.python.org) *Content-Length: 11331 *Ms-Author-Via: DAV *Accept-Ranges: none *ETag: ts20690091.09 *Last-Modified: Fri, 23 Aug 2002 15:49:32 GMT Content-Type: text/html X-Cache: MISS from atlas.gc.ca Connection: close Items marked with * above are either missing or are different than $http_response_header. A clue may be that the "Content-Length" is different, but I don't know why. In particular, I'm looking for "Last-modified". I can get it with lynx, but not with php. John A. Grant ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19109&edit=1

« previous php.bugs (#17876) next »