stream_get_meta_data

PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
stream_get_meta_data - Retrieves header/meta data from streams/file pointers
Manual
Code Examples

stream_get_meta_data( resource$stream ): array

Returns information about an existing stream.

Parameters

stream

The stream can be any stream created by fopen, fsockopen pfsockopen and stream_socket_client.

Return Values

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.

Note:

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.

crypto (array) - the TLS connection metadata for this stream. (Note: Only provided when the resource's stream uses TLS.)

Notes

Note:

This function does NOT work on sockets created by the Socket extension.

Related Functions

Example of stream_get_meta_data

Show all examples for stream_get_meta_data

PHP Version:


Function stream_get_meta_data:

Streams Functions

Most used PHP functions