php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19109 $http_response_header from fopen() is incomplete
Submitted: 2002-08-26 11:56 UTC Modified: 2002-08-26 12:33 UTC
From: jagrant at gsc dot nrcan dot gc dot ca Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.2.2 OS: SunOS nrn1 5.8 Generic_108528-12
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jagrant at gsc dot nrcan dot gc dot ca
New email:
PHP Version: OS:

 

 [2002-08-26 11:56 UTC] jagrant at gsc dot nrcan dot gc dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-26 12:33 UTC] iliaa@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC