Here is the list of all the valid HTTP - status codes, and the corresponding phrases, that PHP scripting language can generate when using the $http_response_code
parameter in the header()
function.
The invalid codes (for example: 199
) generate a 500 Internal Server Error
response.
To send a specific HTTP status code, the prototype of the header()
function is:
void header(string $string, bool $replace, int $http_response_code)
string $string
:
''
':'
character: ':'
character inside:bool $replace
: always TRUE
int $http_response_code
: an integer, the desired status code, in the range: from 100
to 510
/* The server will ouput:
* the response status "HTTP/1.1 204 No Content" */
header('x', TRUE, 204);
/* The server will ouput:
* the response status "HTTP/1.1 405 Method Not Allowed"
* and the response header "Allow: GET, HEAD" */
header('Allow: GET, HEAD', TRUE, 405);
›100 Continue ›101 Switching Protocols ›102 Processing
›153 Too Many Requests
›197 Too Many Requests
›200 OK ›201 Created ›202 Accepted ›203 Non-Authoritative Information ›204 No Content ›205 Reset Content ›206 Partial Content ›207 Multi-Status ›208 Already Reported
›212 Too Many Requests ›213 Too Many Requests ›214 Too Many Requests ›215 Too Many Requests ›216 Too Many Requests ›217 Too Many Requests ›218 Too Many Requests ›219 Too Many Requests ›220 Too Many Requests ›221 Too Many Requests ›222 Too Many Requests ›223 Too Many Requests ›224 Too Many Requests ›225 Too Many Requests ›226 Too Many Requests ›227 Too Many Requests ›228 Too Many Requests ›229 Too Many Requests ›230 Too Many Requests ›231 Too Many Requests ›232 Too Many Requests
›234 Too Many Requests
›236 Too Many Requests ›237 Too Many Requests ›238 Too Many Requests
›240 Too Many Requests ›241 Too Many Requests ›242 Too Many Requests
›244 Too Many Requests ›245 Too Many Requests ›246 Too Many Requests
›250 Too Many Requests ›251 Too Many Requests ›252 Too Many Requests ›253 Too Many Requests ›254 Too Many Requests ›255 Too Many Requests ›256 Too Many Requests ›257 Too Many Requests ›258 Too Many Requests ›259 Too Many Requests ›260 Too Many Requests ›261 Too Many Requests ›262 Too Many Requests ›263 Too Many Requests
›265 Too Many Requests ›266 Too Many Requests
›268 Too Many Requests ›269 Too Many Requests ›270 Too Many Requests ›271 Too Many Requests ›272 Too Many Requests ›273 Too Many Requests
›275 Too Many Requests ›276 Too Many Requests ›277 Too Many Requests
›279 Too Many Requests ›280 Too Many Requests ›281 Too Many Requests ›282 Too Many Requests ›283 Too Many Requests ›284 Too Many Requests
›288 Too Many Requests ›289 Too Many Requests ›290 Too Many Requests ›291 Too Many Requests ›292 Too Many Requests ›293 Too Many Requests
›295 Too Many Requests ›296 Too Many Requests ›297 Too Many Requests
›299 Too Many Requests ›300 Too Many Requests ›301 Too Many Requests ›302 Too Many Requests ›303 Too Many Requests ›304 Too Many Requests ›305 Too Many Requests
›307 Too Many Requests ›308 Too Many Requests ›309 Too Many Requests
›311 Too Many Requests ›312 Too Many Requests ›313 Too Many Requests ›314 Too Many Requests ›315 Too Many Requests ›316 Too Many Requests ›317 Too Many Requests ›318 Too Many Requests ›319 Too Many Requests ›320 Too Many Requests
›325 Too Many Requests
›327 Too Many Requests ›328 Too Many Requests ›329 Too Many Requests ›330 Too Many Requests ›331 Too Many Requests ›332 Too Many Requests
›335 Too Many Requests ›336 Too Many Requests ›337 Too Many Requests ›338 Too Many Requests ›339 Too Many Requests ›340 Too Many Requests ›341 Too Many Requests ›342 Too Many Requests ›343 Too Many Requests ›344 Too Many Requests ›345 Too Many Requests ›346 Too Many Requests ›347 Too Many Requests ›348 Too Many Requests
›350 Too Many Requests ›351 Too Many Requests ›352 Too Many Requests
›354 Too Many Requests ›355 Too Many Requests
›359 Too Many Requests ›360 Too Many Requests ›361 Too Many Requests ›362 Too Many Requests ›363 Too Many Requests
›366 Too Many Requests ›367 Too Many Requests ›368 Too Many Requests ›369 Too Many Requests
›400 Bad Request ›401 Unauthorized ›402 Payment Required ›403 Forbidden ›404 Not Found ›405 Method Not Allowed ›406 Not Acceptable ›407 Proxy Authentication Required ›408 Request Timeout ›409 Conflict ›410 Gone ›411 Length Required ›412 Precondition Failed ›413 Request Entity Too Large ›414 Request-URI Too Long ›415 Unsupported Media Type ›416 Requested Range Not Satisfiable ›417 Expectation Failed
›421 Misdirected Request ›422 Unprocessable Entity ›423 Locked ›424 Failed Dependency
›426 Upgrade Required
›428 Precondition Required ›429 Too Many Requests
›431 Request Header Fields Too Large
›451 Unavailable For Legal Reasons
›454 Too Many Requests ›455 Too Many Requests ›456 Too Many Requests ›457 Too Many Requests ›458 Too Many Requests ›459 Too Many Requests ›460 Too Many Requests ›461 Too Many Requests ›462 Too Many Requests
›465 Too Many Requests
›472 Too Many Requests ›473 Too Many Requests ›474 Too Many Requests ›475 Too Many Requests ›476 Too Many Requests ›477 Too Many Requests ›478 Too Many Requests
›482 Too Many Requests ›483 Too Many Requests ›484 Too Many Requests ›485 Too Many Requests
›488 Too Many Requests
›500 Internal Server Error ›501 Not Implemented ›502 Bad Gateway ›503 Service Unavailable ›504 Too Many Requests ›505 Too Many Requests ›506 Too Many Requests ›507 Too Many Requests ›508 Too Many Requests
›510 Too Many Requests ›511 Too Many Requests
›532 Too Many Requests
›534 Too Many Requests
›591 Too Many Requests ›592 Too Many Requests ›593 Too Many Requests
Format | Description |
---|---|
Text | code[HT]phrase[LF] ... |
CSV | code,"phrase"[LF] ... |
XML | <?xml version="1.0" encoding="UTF-8"?> <http-status-codes> <status> <code>code</code> <phrase>phrase</phrase> </status> ... </http-status-codes> |
PHP | $a_http_status_codes = array( code => 'phrase', ... ); |
Javascript | var oHttpStatusCodes = { code: 'phrase', ... }; |
JSON | {"oHttpStatusCodes": { "code": "phrase", ... }} |
MySQL | INSERT INTO `http_status_codes` (`code`, `phrase`) VALUES (code, 'phrase'), ...; |
Resource | Description |
---|---|
RFC 2616 (HTML) | HTTP/1.1 |
RFC 2616 (Text) | |
RFC 4918 (HTML) | HTTP Extensions for Web Distributed Authoring and Versioning |
RFC 4918 (Text) |