日期:2014-05-17  浏览次数:20450 次

怎样做页面HTTP状态查询
怎样做页面HTTP状态查询
http://tool.chinaz.com/pagestatus/
就像这个一样的

------解决方案--------------------
读http头啊
------解决方案--------------------
var_dump(getallheaders());
------解决方案--------------------
PHP code

function curl_file_get_contents($durl){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $durl);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_NOBODY, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $r = curl_exec($ch);
    //$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
    return $r;
}