ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilHTTP.php
Go to the documentation of this file.
1<?php
2
9class ilHTTP {
10
14 protected static $http_codes = array(
15 100 => 'Continue',
16 101 => 'Switching Protocols',
17 102 => 'Processing',
18 200 => 'OK',
19 201 => 'Created',
20 202 => 'Accepted',
21 203 => 'Non-Authoritative Information',
22 204 => 'No Content',
23 205 => 'Reset Content',
24 206 => 'Partial Content',
25 207 => 'Multi-Status',
26 300 => 'Multiple Choices',
27 301 => 'Moved Permanently',
28 302 => 'Found',
29 303 => 'See Other',
30 304 => 'Not Modified',
31 305 => 'Use Proxy',
32 306 => 'Switch Proxy',
33 307 => 'Temporary Redirect',
34 400 => 'Bad Request',
35 401 => 'Unauthorized',
36 402 => 'Payment Required',
37 403 => 'Forbidden',
38 404 => 'Not Found',
39 405 => 'Method Not Allowed',
40 406 => 'Not Acceptable',
41 407 => 'Proxy Authentication Required',
42 408 => 'Request Timeout',
43 409 => 'Conflict',
44 410 => 'Gone',
45 411 => 'Length Required',
46 412 => 'Precondition Failed',
47 413 => 'Request Entity Too Large',
48 414 => 'Request-URI Too Long',
49 415 => 'Unsupported Media Type',
50 416 => 'Requested Range Not Satisfiable',
51 417 => 'Expectation Failed',
52 418 => 'I\'m a teapot',
53 422 => 'Unprocessable Entity',
54 423 => 'Locked',
55 424 => 'Failed Dependency',
56 425 => 'Unordered Collection',
57 426 => 'Upgrade Required',
58 449 => 'Retry With',
59 450 => 'Blocked by Windows Parental Controls',
60 500 => 'Internal Server Error',
61 501 => 'Not Implemented',
62 502 => 'Bad Gateway',
63 503 => 'Service Unavailable',
64 504 => 'Gateway Timeout',
65 505 => 'HTTP Version Not Supported',
66 506 => 'Variant Also Negotiates',
67 507 => 'Insufficient Storage',
68 509 => 'Bandwidth Limit Exceeded',
69 510 => 'Not Extended',
70 );
71 const PREFIX = 'HTTP/1.1';
72
73
79 public static function status($status) {
80 if (!array_key_exists($status, self::$http_codes)) {
81 throw new ilException('Wrong HTTP-Status Code');
82 }
83 if (function_exists('http_response_code')) {
84 http_response_code($status);
85 } else {
87 }
88 }
89
90
94 private static function httpResponseCode($status) {
95 $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : self::PREFIX);
96 $string = $protocol . ' ' . $status . ' ' . self::$http_codes[$status];
97 $GLOBALS['http_response_code'] = $status;
98
99 header($string, true, $status);
100 }
101}
Base class for ILIAS Exception handling.
Class ilHTTP.
Definition: class.ilHTTP.php:9
const PREFIX
static $http_codes
static status($status)
static httpResponseCode($status)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']