Php stream_get_meta_data Return Value

Source: Internet
Author: User

The test code is as follows:

Copy codeThe Code is as follows:
<? Php
$ Fp = fopen ("http://www.sina.com.cn", 'R ');
$ Stream_meta = stream_get_meta_data ($ fp );
Print_r ($ stream_meta );
?>

The output on my local machine is as follows:
Array
(
[Wrapper_data] => Array
(
[0] => HTTP/1.0 200 OK
[1] => Date: Tue, 06 Dec 2011 10:08:11 GMT
[2] => Server: Apache
[3] => Last-Modified: Tue, 06 Dec 2011 10:07:12 GMT
[4] => Accept-Ranges: bytes
[5] => X-Powered-By: mod_xlayout/rc2
[6] => Cache-Control: max-age = 60
[7] => Expires: Tue, 06 Dec 2011 10:09:11 GMT
[8] => Vary: Accept-Encoding
[9] => X-UA-Compatible: IE = EmulateIE7
[10] => Content-Type: text/html
[11] => Age: 26
[12] => Content-Length: 675274
[13] => X-Cache: HIT from xd33-98.HP08040037.sina.com.cn
[14] => Connection: close
)

[Wrapper_type] => http
[Stream_type] => tcp_socket/ssl
[Mode] => r
[Unread_bytes] = & gt; 3759
[Seekable] =>
[Uri] => http://www.sina.com.cn
[Timed_out] =>
[Blocked] => 1
[Eof] =>
)

Description

Array stream_get_meta_data (int $ fp)
Returns information about an existing stream. It can be any stream created through fopen (), fsockopen () and pfsockopen. The returned array contains the following items:

Timed_out (bool)-TRUE if the stream times out when data is waiting in the last call of fread () or fgets.

Blocked (bool)-TRUE if the stream is in congested IO mode. See stream_set_blocking ().

Eof (bool)-TRUE if the stream reaches the end of the file. Note that the value of the socket stream can be TRUE even if unread_bytes is a non-zero value. To determine whether more data is readable, use feof () instead of reading this item.

Unread_bytes (int)-number of bytes in the current PHP internal buffer.

Note: Do not use this value in the script.

The following projects are newly added to PHP 4.3:

Stream_type (string)-A annotation that describes the underlying implementation of a stream.

Wrapper_type (string)-Annotation of the layer protocol encapsulation implementation that describes the stream.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.