PHP完全自学手册(珍藏版) 中文pdf扫描版下载
<?php
/** * @author lanren <service@kuitao8.com> * @link http://www.kuitao8.com/ * @copyright 2010-2014 懒人程序 * @since 1.0 */ header("Content-type:text/html;charset=utf-8"); function GetCurl($url){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY,true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true); curl_setopt($ch, CURLOPT_AUTOREFERER,true); curl_setopt($ch, CURLOPT_TIMEOUT,30); $rtn = curl_exec($ch); curl_exec($ch); return $rtn; } $resp = GetCurl("http://www.kuitao8.com/2789.shtml"); if(strpos($resp,'404 Not Found')==true) { exit('这个页面是404'); }
转载请注明:谷谷点程序 » php利用curl判断页面是否为404找不到