stream_get_meta_dataRetrieves header/meta data from streams/file pointers
&reftitle.description;
arraystream_get_meta_dataresourcestream
Returns information about an existing stream.
&reftitle.parameters;
stream
The stream can be any stream created by fopen,
fsockopen and pfsockopen.
&reftitle.returnvalues;
The result array contains the following items:
timed_out (bool) - &true; if the stream
timed out while waiting for data on the last call to
fread or fgets.
blocked (bool) - &true; if the stream is
in blocking IO mode. See stream_set_blocking.
eof (bool) - &true; if the stream has reached
end-of-file. Note that for socket streams this member can be &true;
even when unread_bytes is non-zero. To
determine if there is more data to be read, use
feof instead of reading this item.
unread_bytes (int) - the number of bytes
currently contained in the PHP's own internal buffer.
You shouldn't use this value in a script.
stream_type (string) - a label describing
the underlying implementation of the stream.
wrapper_type (string) - a label describing
the protocol wrapper implementation layered over the stream.
See for more information about wrappers.
wrapper_data (mixed) - wrapper specific
data attached to this stream. See for
more information about wrappers and their wrapper data.
mode (string) - the type of access required for
this stream (see Table 1 of the fopen() reference)
seekable (bool) - whether the current stream can
be seeked.
uri (string) - the URI/filename associated with this
stream.
&reftitle.examples;
stream_get_meta_data example
]]>
&example.outputs.similar;
Array
(
[0] => HTTP/1.1 200 OK
[1] => Server: Apache/2.2.3 (Red Hat)
[2] => Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT
[3] => ETag: "b300b4-1b6-4059a80bfd280"
[4] => Accept-Ranges: bytes
[5] => Content-Type: text/html; charset=UTF-8
[6] => Set-Cookie: FOO=BAR; expires=Fri, 21-Dec-2012 12:00:00 GMT; path=/; domain=.example.com
[6] => Connection: close
[7] => Date: Fri, 16 Oct 2009 12:00:00 GMT
[8] => Age: 1164
[9] => Content-Length: 438
)
[wrapper_type] => http
[stream_type] => tcp_socket/ssl
[mode] => r
[unread_bytes] => 438
[seekable] =>
[uri] => http://www.example.com/
[timed_out] =>
[blocked] => 1
[eof] =>
)
]]>
&reftitle.notes;
This function does NOT work on sockets created by the Socket extension.
&reftitle.seealso;
get_headers$http_response_header