Skip to content

Instantly share code, notes, and snippets.

@kchat001
Last active August 18, 2016 15:53
Show Gist options
  • Save kchat001/b5d2410fc6d8321794d46422ca81b906 to your computer and use it in GitHub Desktop.
Save kchat001/b5d2410fc6d8321794d46422ca81b906 to your computer and use it in GitHub Desktop.
HTTP Response Status Codes as constants
<?php
/**
* @author Khalid Chatar
*
* Contains http response status codes
*/
class HTTPCodes {
const INFO_CONTINUE = 100;
const INFO_SWITCHING_PROTOCOL = 101;
const SUCCESS_OK = 200;
const SUCCESS_CREATED = 201;
const SUCCESS_ACCEPTED = 202;
const SUCCESS_NON_AUTHORITATIVE_INFO = 203;
const SUCCESS_NO_CONTENT = 204;
const SUCCESS_RESET_CONTENT = 205;
const SUCCESS_PARTIAL_CONTENT = 206;
const REDIRECT_MULT_CHOICE = 300;
const REDIRECT_MOVED = 301;
const REDIRECT_FOUND = 302;
const REDIRECT_SEE_OTHER = 303;
const REDIRECT_NOT_MODIFIED = 304;
const REDIRECT_USE_PROXY = 305;
const REDIRECT_UNUSED = 306;
const REDIRECT_REDIRECT_PERMANENT = 307;
const REDIRECT_REDIRECT_TEMP = 308;
const ERROR_BAD_REQUEST = 400;
const ERROR_UNAUTHORIZED = 401;
const ERROR_PAYMENT_REQUIRED = 402;
const ERROR_FORBIDDEN = 403;
const ERROR_NOT_FOUND = 404;
const ERROR_METHOD_NOT_ALLOWED = 405;
const ERROR_NOT_ACCEPTABLE = 406;
const ERROR_AUTHENTICATE_WITH_PROXY = 407;
const ERROR_REQUEST_TIMEOUT = 408;
const ERROR_CONFLICT = 409;
const ERROR_REQUESTED_CONTENT_GONE = 410;
const ERROR_CONTENT_LENGTH_REQUIRED = 411;
const ERROR_PRECONDITION_FAILED = 412;
const ERROR_PAYLOAD_TOO_LARGE = 413;
const ERROR_URI_TOO_LONG = 414;
const ERROR_UNSUPPORTED_MEDIA_TYPE = 415;
const ERROR_REQUESTED_RANGE = 416;
const ERROR_EXPECTATION_FAILED = 417;
const ERROR_MISDIRECTED_REQUEST = 421;
const ERROR_UPGRADE_REQUIRED = 426;
const ERROR_PRECONDITION_REQUIRED = 428;
const ERROR_TOO_MANY_REQUESTS = 429;
const ERROR_REQUEST_HEADERS_TOO_LONG = 431;
const ERROR_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
const SERVER_INTERNAL_ERROR = 500;
const SERVER_NOT_IMPLEMENTED = 501;
const SERVER_BAD_GATEWAY = 502;
const SERVER_SERVICE_UNAVAILABLE = 503;
const SERVER_GATEWAY_TIMEOUT = 504;
const SERVER_HTTP_VERSION_NOT_SUPPORTED = 505;
const SERVER_VARIANT_ALSO_NEGOTIATES_1 = 506;
const SERVER_VARIANT_ALSO_NEGOTIATES_2 = 507;
const SERVER_NETWORK_AUTHENTICATION_REQUIRED = 511;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment