PHP | stream_get_meta_data() Function Last Updated : 16 Jul, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The stream_get_meta_data() function is an inbuilt function in PHP which is used to get the header or meta data from the streams/file pointers.Syntax: array stream_get_meta_data( $stream ) Parameters: The function accepts single parameter $stream, which specifies the meta data to be retrieve and which is created by any function fopen(), fsockopen() and pfsockopen().Return Value: This function returns an array which contains the following items: timed_out: It is a boolean type items and TRUE if the stream timed out.blocked: It is a boolean type items and it is True if the stream is in blocking IO mode.eof(bool) It is optional. It is True if the stream reached at end-of-file.unread_bytes: Number of bytes in internal buffer.stream_type: It is used to specify the implementation of the stream.wrapper_type: It is used to specify the protocol wrapper implementation layer.wrapper_data: It is a specific data attached to this stream.mode: It is the type of access required for this stream.seekable: It is true when the current stream seeked.uri: User Provided Uniform resource identifier. Below programs illustrate the stream_get_meta_data() function in PHP:Program 1: PHP <?php // PHP program to illustrate // stream_get_meta_data function $url = 'http://php.net/manual/en/function.stream-get-meta-data.php'; $file = fopen($url, 'r'); $meta_data = stream_get_meta_data($file); print_r($meta_data); fclose($file); ?> Output: Array ( [timed_out] => [blocked] => 1 [eof] => [wrapper_data] => Array ( [0] => HTTP/1.1 200 OK [1] => Server: nginx/1.10.3 [2] => Date: Mon, 17 Dec 2018 11:04:39 GMT [3] => Content-Type: text/html; charset=utf-8 [4] => Connection: close [5] => Content-language: en [6] => X-Frame-Options: SAMEORIGIN [7] => Set-Cookie: LAST_LANG=en; expires=Tue, 17-Dec-2019 11:04:39 GMT; Max-Age=31536000; path=/; domain=.php.net [8] => Set-Cookie: COUNTRY=NA%2C54.201.119.186; expires=Mon, 24-Dec-2018 11:04:39 GMT; Max-Age=604800; path=/; domain=.php.net [9] => Link: ; rel=shorturl [10] => Last-Modified: Mon, 17 Dec 2018 05:06:18 GMT [11] => Vary: Accept-Encoding ) [wrapper_type] => http [stream_type] => tcp_socket/ssl [mode] => r [unread_bytes] => 7647 [seekable] => [uri] => http://php.net/manual/en/function.stream-get-meta-data.php ) Program 2: Program to print the length of array return by the function. php <?php // PHP program to illustrate // stream_get_meta_data function // url to be open using fopen $url = 'http://www.php.net/news.rss'; // checking is url openable or not if (!$fp = fopen($url, 'r')) { trigger_error("Unable to open URL ($url)", E_USER_ERROR); } $fp = fopen($url, 'r'); $meta_data = stream_get_meta_data($fp); print(sizeof($meta_data)); fclose($fp); ?> Output: 10 Reference: http://php.net/manual/en/function.stream-get-meta-data.php Comment More infoAdvertise with us Next Article PHP | stream_is_local() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-array PHP-function Similar Reads PHP | stream_get_filters() Function The stream_get_filters() function is an inbuilt function in PHP which is used to get the list of registered stream filters. Syntax: array stream_get_filters( void ) Parameters: This function does not accept any parameter. Return Value: This function returns an array containing the name of all availa 1 min read PHP | stream_is_local() Function The stream_is_local() function is an inbuilt function in PHP which is used to check if a stream is a local stream or URL. Syntax: bool stream_is_local( $stream ) Parameters: This function accepts single parameter $stream, which is used to specify the stream to be check. Return Value: This function r 1 min read PHP | stream_get_wrappers() Function The stream_get_wrappers() function is an inbuilt function in PHP which is used to get the list of registered streams available on the running system. Syntax: array stream_get_wrappers( void ) Parameters: This function does not accept any parameter. Return Value: The function returns an array contain 1 min read PHP ob_get_status() Function The ob_get_status() is an inbuilt function in PHP that is used for retrieving the status of the output buffer. Syntaxob_get_status(bool $full_status = false) : arrayParameter This function accepts only one parameter which is described below. $full_status: This is an optional parameter. If this param 2 min read PHP token_get_all() Function The token_get_all() function is an inbuilt function in PHP that is used to tokenize a given PHP source code string into an array of tokens. This function is particularly useful for analyzing, parsing, or manipulating PHP code programmatically. Syntax: token_get_all(string $code, int $flags = 0)Param 2 min read PHP | read_exif_data() Function The read_exif_data() function is an inbuilt function in PHP which is used to read the EXIF headers from an image file and is an alternate for exif_read_data(). Syntax: array read_exif_data( mixed $stream, string $sections, bool $arrays, bool $thumbnail ) Parameters: This function accepts four parame 2 min read Like