$url= "http://www.sina.com/"; functionParse$url) { if(! ($fp= @fopen($url, ' RB ')) ){ Exit(' Path error '); } $meta=Stream_get_meta_data($fp); foreach(Array_keys($meta) as $h){ $v=$meta[$h]; Echo"".$h.": ".$v." <br/> "; if(Is_array($v)){ foreach(Array_keys($v) as $hh){ $VV=$v[$hh]; Echo"".$hh.": ".$VV." <br/> "; } } } fclose($fp); } Parse ($url); /** wrapper_data:array0:http/1.1 301 Moved Permanently1:Server:nginx2:Date:Mon, APR 10:09:21 Gmt3:conten T-TYPE:TEXT/HTML4:LOCATION:HTTP://WWW.SINA.COM.CN/5: Expires:mon, APR 10:11:21 gmt6:cache-control:max-age=12 07:age:118:content-length:1789:x-cache:hit from ctc.gz.1cf2.42.spool.sina.com.cn10:connection:close11:http/1.1 20 0 Ok12:content-type:text/html13:vary:accept-encoding14:x-powered-by:schi_v1.0215:server:nginx16:date:mon, APR 10:09:31 gmt17:last-modified:mon, Apr 10:08:29 GMT18:Expires:Mon, Apr 10:10:31 gmt19:cache-cont Rol:max-age=6020:content-length:57527821:x-cache:hit from Ctc.gz.1cf2.45.spool.sina.com.cn22:connection: Closewrapper_type:httpstream_type:tcp_socketmode:rbunread_bytes:0seekable:uri:http://www.sina.com/timed_out: Blocked:1eof:*/
Stream_get_meta_data (open file handle) Gets the name of any Web server and gets header/metadata from the encapsulated protocol file pointer