curl http_code

//[Informational 1xx]
$http_code["0"]="Unable to access";
$http_code["100"]="Continue";
$http_code["101"]="Switching Protocols";

//[Successful 2xx]
$http_code["200"]="OK";
$http_code["201"]="Created";
$http_code["202"]="Accepted";
$http_code["203"]="Non-Authoritative Information";
$http_code["204"]="No Content";
$http_code["205"]="Reset Content";
$http_code["206"]="Partial Content";

//[Redirection 3xx]
$http_code["300"]="Multiple Choices";
$http_code["301"]="Moved Permanently";
$http_code["302"]="Found";
$http_code["303"]="See Other";
$http_code["304"]="Not Modified";
$http_code["305"]="Use Proxy";
$http_code["306"]="(Unused)";
$http_code["307"]="Temporary Redirect";

//[Client Error 4xx]
$http_code["400"]="Bad Request";
$http_code["401"]="Unauthorized";
$http_code["402"]="Payment Required";
$http_code["403"]="Forbidden";
$http_code["404"]="Not Found";
$http_code["405"]="Method Not Allowed";
$http_code["406"]="Not Acceptable";
$http_code["407"]="Proxy Authentication Required";
$http_code["408"]="Request Timeout";
$http_code["409"]="Conflict";
$http_code["410"]="Gone";
$http_code["411"]="Length Required";
$http_code["412"]="Precondition Failed";
$http_code["413"]="Request Entity Too Large";
$http_code["414"]="Request-URI Too Long";
$http_code["415"]="Unsupported Media Type";
$http_code["416"]="Requested Range Not Satisfiable";
$http_code["417"]="Expectation Failed";

//[Server Error 5xx]
$http_code["500"]="Internal Server Error";
$http_code["501"]="Not Implemented";
$http_code["502"]="Bad Gateway";
$http_code["503"]="Service Unavailable";
$http_code["504"]="Gateway Timeout";
$http_code["505"]="HTTP Version Not Supported";

 

$ch = curl_init();
$url = "http://www.ww.com/ ";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt($ch,CURLOPT_TIMTOUT,2);
curl_setopt($ch,CURLOPT_NOBODY,1);
$out = curl_exec($ch);
$intReturnCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if( $intReturnCode != "200" ){
error_log($http_code[$intReturnCode]. " " . $url);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值