PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
function IsPageNotFound($url)
{
$result = false;
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
//
// Get the HTML or whatever is linked in $url
//
$response = curl_exec($handle);
//
// Let's check for 404 (File not found)
//
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if ($httpCode == 404)
$result = true;
return $result;
}
$isPageNotFound = IsPageNotFound("http://www.kuitao8.com/abc/");
if ( $isPageNotFound )
{
echo "404";
}
转载请注明:谷谷点程序 » php检查网址是不是404