3 * List of HTTP status codes.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
29 * Get the message associated with HTTP response code $code
31 * @param $code Integer: status code
32 * @return String or null: message or null if $code is not in the list of
35 public static function getMessage( $code ) {
36 static $statusMessage = array(
38 101 => 'Switching Protocols',
43 203 => 'Non-Authoritative Information',
45 205 => 'Reset Content',
46 206 => 'Partial Content',
47 207 => 'Multi-Status',
48 300 => 'Multiple Choices',
49 301 => 'Moved Permanently',
52 304 => 'Not Modified',
54 307 => 'Temporary Redirect',
56 401 => 'Unauthorized',
57 402 => 'Payment Required',
60 405 => 'Method Not Allowed',
61 406 => 'Not Acceptable',
62 407 => 'Proxy Authentication Required',
63 408 => 'Request Timeout',
66 411 => 'Length Required',
67 412 => 'Precondition Failed',
68 413 => 'Request Entity Too Large',
69 414 => 'Request-URI Too Large',
70 415 => 'Unsupported Media Type',
71 416 => 'Request Range Not Satisfiable',
72 417 => 'Expectation Failed',
73 422 => 'Unprocessable Entity',
75 424 => 'Failed Dependency',
76 428 => 'Precondition Required',
77 429 => 'Too Many Requests',
78 431 => 'Request Header Fields Too Large',
79 500 => 'Internal Server Error',
80 501 => 'Not Implemented',
82 503 => 'Service Unavailable',
83 504 => 'Gateway Timeout',
84 505 => 'HTTP Version Not Supported',
85 507 => 'Insufficient Storage',
86 511 => 'Network Authentication Required',
88 return isset( $statusMessage[$code] ) ?
$statusMessage[$code] : null;