Re: Means of collecting HTTP response headers

From: Date: Sat, 31 Jul 2004 15:26:04 +0000
Subject: Re: Means of collecting HTTP response headers
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-192398@lists.php.net to get a copy of this message
Curt Zirzow wrote:
* Thus wrote Gerard Samuel:
On Friday 30 July 2004 01:32 pm, Gerard Samuel wrote:
A means that is not specifically tied to Apache functions. Just looking for a way so that it works no matter the webserver.
Seems like the function stream_get_meta_data() will fill the job..
hmm.. are you able to get the headers from that? could you provide a sample?
<?php echo "<pre>"; print_r(stream_get_meta_data(fopen("http://www.google.com","r"))); echo "</pre>"; ?> That prints : Array (
    [wrapper_data] => Array
        (
            [0] => HTTP/1.0 200 OK
            [1] => Date: Sat, 31 Jul 2004 15:25:13 GMT
            [2] => Content-Length: 2017
            [3] => Content-Type: text/html
            [4] => Cache-Control: private
            [5] => Set-Cookie: PREF=ID=3aef968834cf9173:TM=1091287513:LM=1091287513:S=UpAZlwk4TMm5Nydd; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
            [6] => Server: GWS/2.1
            [7] => Via: 1.1 supercache (NetCache NetApp/5.5R3)
        )
    [wrapper_type] => HTTP
    [stream_type] => socket
    [unread_bytes] => 0
    [timed_out] =>
    [blocked] => 1
    [eof] =>
)

« previous php.general (#192398) next »