The test code is as follows:
Copy Code code as follows:
<?php
$FP =fopen ("http://www.sina.com.cn", ' R ');
$stream _meta = Stream_get_meta_data ($FP);
Print_r ($stream _meta);
?>
in my native output is as follows:
Array
(
[Wrapper_data] => Array
(
[0] => http/1.0 OK
[1] => date:tue, Dec 10:08:11 GMT
[2] => Server:apache
[3] => last-modified:tue, Dec 10:07:12 GMT
[4] => accept-ranges:bytes
[5] => X-powered-by:mod_xlayout/rc2
[6] => cache-control:max-age=60
[7] => expires:tue, Dec 10:09:11 GMT
[8] => vary:accept-encoding
[9] => x-ua-compatible:ie=emulateie7
[Ten] => content-type:text/html
[one] => age:26
[[] => content-length:675274
[] => x-cache:hit from xd33-98.hp08040037.sina.com.cn
[] => connection:close
)
[Wrapper_type] => http
[Stream_type] => Tcp_socket/ssl
[mode] => R
[unread_bytes] => 3759
[Seekable] =>
[URI] => http://www.sina.com.cn
[timed_out] =>
[blocked] => 1
[EOF] =>
)
Description
array stream_get_meta_data (int $fp)
returns information about the existing stream. can be any stream established through fopen (), Fsockopen () and Pfsockopen (). The returned array contains the following items:
Timed_out (BOOL)-True if waiting for data Shireu timed out in the last Call to Fread () or fgets ().
blocked (bool)-true if the stream is in blocked IO mode. See Stream_set_blocking ().
EOF (BOOL)-true if the stream reaches the end of the file. Note that you can also be TRUE for the socket stream even when unread_bytes is a value other than 0. To determine if more data is readable, use feof () instead of reading the value of this item.
unread_bytes (int)-The number of bytes currently in PHP's own internal buffer.
Note: Do not use this value in scripts.
the following items are PHP 4.3 new:
Stream_type (String)-a callout that describes the underlying implementation of a stream.
Wrapper_type (String)-a callout that encapsulates the implementation of a layered protocol that describes a stream. For more information on encapsulating protocols, see supported protocols and encapsulation protocols.
wrapper_data (mixed)-the package protocol data that is attached to the current stream. For more information on encapsulation protocols and their data, see supported protocols and encapsulation protocols.
Filters (Array)-contains arrays of any filter names that are superimposed on the current stream. The filter's documentation is shown in the appendix to the list of available filters.
Note:
This function is introduced in PHP 4.3, before this release, you can use Socket_get_status () to obtain the first four items and only for the socket based flow.
in PHP 4.3 and later, Socket_get_status () is the alias for this function.
Note: This function does not work on streams created through the Socket extension library.
the following items for PHP 5.0 add:
mode (String)-the type of access required for the current stream (see table 1 in fopen ()).
seekable (BOOL)-can be positioned in the current stream.
URI (String)-the URI or file name associated with the current stream.