Skip to content

Instantly share code, notes, and snippets.

@vool
Created September 7, 2011 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vool/1201194 to your computer and use it in GitHub Desktop.
Save vool/1201194 to your computer and use it in GitHub Desktop.
http error codes in a php array
<?php
$error = array (
//4xx: Client Error
400 => array("title" => "Bad Request", "desc" => "The server did not understand the request"),
401 => array("title" => "Unauthorized", "desc" => "The requested page needs a username and a password"),
402 => array("title" => "Payment Required", "desc" => "You can not use this code yet"),
403 => array("title" => "Forbidden", "desc" => "Access is forbidden to the requested page"),
404 => array("title" => "Not Found", "desc" => "The server can not find the requested page"),
405 => array("title" => "Method Not Allowed", "desc" => "The method specified in the request is not allowed"),
406 => array("title" => "Not Acceptable", "desc" => "The server can only generate a response that is not accepted by the client"),
407 => array("title" => "Proxy Authentication Required", "desc" => "You must authenticate with a proxy server before this request can be served"),
408 => array("title" => "Request Timeout", "desc" => "The request took longer than the server was prepared to wait"),
409 => array("title" => "Conflict", "desc" => "The request could not be completed because of a conflict"),
410 => array("title" => "Gone", "desc" => "The requested page is no longer available"),
411 => array("title" => "Length Required", "desc" => "The \"Content-Length\" is not defined. The server will not accept the request without it"),
412 => array("title" => "Precondition Failed", "desc" => "The precondition given in the request evaluated to false by the server"),
413 => array("title" => "Request Entity Too Large", "desc" => "The server will not accept the request, because the request entity is too large"),
414 => array("title" => "Request-url Too Long", "desc" => "The server will not accept the request, because the url is too long. Occurs when you convert a \"post\" request to a \"get\" request with a long query information"),
415 => array("title" => "Unsupported Media Type", "desc" => "The server will not accept the request, because the media type is not supported"),
416 => array("title" => "...", "desc" => "..."),
417 => array("title" => "Expectation Failed", "desc" => "..."),
// 5xx: Server Error
500 => array("title" => "Internal Server Error", "desc" => "The request was not completed. The server met an unexpected condition"),
501 => array("title" => "Not Implemented", "desc" => "The request was not completed. The server did not support the functionality required"),
502 => array("title" => "Bad Gateway", "desc" => "The request was not completed. The server received an invalid response from the upstream server"),
503 => array("title" => "Service Unavailable", "desc" => "The request was not completed. The server is temporarily overloading or down"),
504 => array("title" => "Gateway Timeout", "desc" => "The gateway has timed out"),
505 => array("title" => "HTTP Version Not Supported", "desc" => "The server does not support the \"http protocol\" version"),
)
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment