http code 状态码 错误码
//常用
成功2×× 成功处理了请求的状态码。
200 服务器已成功处理了请求并提供了请求的网页。
204 服务器成功处理了请求,但没有返回任何内容。
重定向3×× 每次请求中使用重定向不要超过 5 次。
301 请求的网页已永久移动到新位置。当URLs发生变化时,使用301代码。搜索引擎索引中保存新的URL。
302 请求的网页临时移动到新位置。搜索引擎索引中保存原来的URL。
304 如果网页自请求者上次请求后没有更新,则用304代码告诉搜索引擎机器人,可节省带宽和开销。
客户端错误4×× 表示请求可能出错,妨碍了服务器的处理。
400 服务器不理解请求的语法。
403 服务器拒绝请求。
404 服务器找不到请求的网页。服务器上不存在的网页经常会返回此代码。
410 请求的资源永久删除后,服务器返回此响应。该代码与 404(未找到)代码相似,但在资源以前存在而现在不存在的情况下,有时用来替代404 代码。如果资源已永久删除,应当使用 301 指定资源的新位置。
服务器错误5×× 表示服务器在处理请求时发生内部错误。这些错误可能是服务器本身的错误,而不是请求出错。
500 服务器遇到错误,无法完成请求。
503 服务器目前无法使用(由于超载或停机维护)。通常,这只是暂时状态。
//全部
$http_code["0"]="Unable to access";
$http_code["100"]="Continue";
$http_code["101"]="Switching Protocols";
$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”;
$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”;
$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”;
$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.ganguoyuan.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);