Skip to content

Instantly share code, notes, and snippets.

Created May 21, 2012 21:16
Show Gist options
  • Save anonymous/2764783 to your computer and use it in GitHub Desktop.
Save anonymous/2764783 to your computer and use it in GitHub Desktop.
<?php
$version = 'HTTP/' . @$_GET['version'] ?: '1.1';
$code = @$_GET['code'] ?: '200';
switch ($code) {
case '100':
header($version . ' 100 Continue', true, 100);
break;
case '101':
header($version . ' 101 Switching Protocols', true, 101);
break;
case '200':
header($version . ' 200 OK', true, 200);
break;
case '201':
header($version . ' 201 Created', true, 201);
break;
case '202':
header($version . ' 202 Accepted', true, 202);
break;
case '203':
header($version . ' 203 Non-Authoritative Information', true, 203);
break;
case '204':
header($version . ' 204 No Content', true, 204);
break;
case '205':
header($version . ' 205 Reset Content', true, 205);
break;
case '206':
header($version . ' 206 Partial Content', true, 206);
break;
case '300':
header($version . ' 300 Multiple Choices', true, 300);
break;
case '301':
header($version . ' 301 Moved Permanently', true, 301);
break;
case '302':
header($version . ' 302 Found', true, 302);
break;
case '303':
header($version . ' 303 See Other', true, 303);
break;
case '304':
header($version . ' 304 Not Modified', true, 304);
break;
case '305':
header($version . ' 305 Use Proxy', true, 305);
break;
case '307':
header($version . ' 307 Temporary Redirect', true, 307);
break;
case '400':
header($version . ' 400 Bad Request', true, 400);
break;
case '401':
header($version . ' 401 Unauthorized', true, 401);
break;
case '402':
header($version . ' 402 Payment Required', true, 402);
break;
case '403':
header($version . ' 403 Forbidden', true, 403);
break;
case '404':
header($version . ' 404 Not Found', true, 404);
break;
case '405':
header($version . ' 405 Method Not Allowed', true, 405);
break;
case '406':
header($version . ' 406 Not Acceptable', true, 406);
break;
case '407':
header($version . ' 407 Proxy Authentication Required', true, 407);
break;
case '408':
header($version . ' 408 Request Timeout', true, 408);
break;
case '409':
header($version . ' 409 Conflict', true, 409);
break;
case '410':
header($version . ' 410 Gone', true, 410);
break;
case '411':
header($version . ' 411 Length Required', true, 411);
break;
case '412':
header($version . ' 412 Precondition Failed', true, 412);
break;
case '413':
header($version . ' 413 Request Entity Too Large', true, 413);
break;
case '414':
header($version . ' 414 Request-URI Too Long', true, 414);
break;
case '415':
header($version . ' 415 Unsupported Media Type', true, 415);
break;
case '416':
header($version . ' 416 Requested Range Not Satisfiable', true, 416);
break;
case '417':
header($version . ' 417 Expectation Failed', true, 417);
break;
case '500':
header($version . ' 500 Internal Server Error', true, 500);
break;
case '501':
header($version . ' 501 Not Implemented', true, 501);
break;
case '502':
header($version . ' 502 Bad Gateway', true, 502);
break;
case '503':
header($version . ' 503 Service Unavailable', true, 503);
break;
case '504':
header($version . ' 504 Gateway Timeout', true, 504);
break;
case '505':
header($version . ' 505 HTTP Version Not Supported', true, 505);
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment