第一种:php自带函数 get_headers($url);
$arr = get_headers('http://www.baidu.com'); print_r($arr);第二种:打印$http_response_header变量。该变量在脚本中调用get_headers 或者使用file_get_contents($url后生效) $html=file_get_contents('http://www.baidu.com'); print_r($http_response_header);第三种:使用fread fopen之类函数,然后用stream_get_meta_data函数获取打开文件数据流信息 $fp=fopen('http://www.baidu.com','r'); //print_r($http_response_header); print_r(stream_get_meta_data($fp)); |
GMT+8, 2024-5-20 01:57 , Processed in 0.224301 second(s), 11 queries , Xcache On.
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.