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 TRUEint $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
›200 OK ›201 Created ›202 Accepted ›203 Non-Authoritative Information ›204 No Content ›205 Reset Content ›206 Partial Content ›207 Multi-Status
›300 Multiple Choices ›301 Moved Permanently ›302 Found ›303 See Other ›304 Not Modified ›305 Use Proxy ›306 unused ›307 Temporary Redirect
›400 Bad Request ›401 Authorization Required ›402 Payment Required ›403 Forbidden ›404 Not Found ›405 Method Not Allowed ›406 Not Acceptable ›407 Proxy Authentication Required ›408 Request Time-out ›409 Conflict ›410 Gone ›411 Length Required ›412 Precondition Failed ›413 Request Entity Too Large ›414 Request-URI Too Large ›415 Unsupported Media Type ›416 Requested Range Not Satisfiable ›417 Expectation Failed ›418 unused ›419 unused ›420 unused ›421 unused ›422 Unprocessable Entity ›423 Locked ›424 Failed Dependency ›425 No code ›426 Upgrade RequiredSocket error 0: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution