21 101 =>
'Switching Protocols',
26 203 =>
'Non-Authorative Information',
28 205 =>
'Reset Content',
29 206 =>
'Partial Content',
30 207 =>
'Multi-Status',
31 208 =>
'Already Reported',
33 300 =>
'Multiple Choices',
34 301 =>
'Moved Permanently',
37 304 =>
'Not Modified',
39 307 =>
'Temporary Redirect',
40 308 =>
'Permanent Redirect',
42 401 =>
'Unauthorized',
43 402 =>
'Payment Required',
46 405 =>
'Method Not Allowed',
47 406 =>
'Not Acceptable',
48 407 =>
'Proxy Authentication Required',
49 408 =>
'Request Timeout',
52 411 =>
'Length Required',
53 412 =>
'Precondition failed',
54 413 =>
'Request Entity Too Large',
55 414 =>
'Request-URI Too Long',
56 415 =>
'Unsupported Media Type',
57 416 =>
'Requested Range Not Satisfiable',
58 417 =>
'Expectation Failed',
59 418 =>
'I\'m a teapot',
60 421 =>
'Misdirected Request',
61 422 =>
'Unprocessable Entity',
63 424 =>
'Failed Dependency',
64 426 =>
'Upgrade Required',
65 428 =>
'Precondition Required',
66 429 =>
'Too Many Requests',
67 431 =>
'Request Header Fields Too Large',
68 451 =>
'Unavailable For Legal Reasons',
69 500 =>
'Internal Server Error',
70 501 =>
'Not Implemented',
72 503 =>
'Service Unavailable',
73 504 =>
'Gateway Timeout',
74 505 =>
'HTTP Version not supported',
75 506 =>
'Variant Also Negotiates',
76 507 =>
'Insufficient Storage',
77 508 =>
'Loop Detected',
78 509 =>
'Bandwidth Limit Exceeded',
79 510 =>
'Not extended',
80 511 =>
'Network Authentication Required',
163 if ($statusCode < 100 || $statusCode > 999) {
164 throw new \InvalidArgumentException(
'The HTTP status code must be exactly 3 digits');
167 $this->status = $statusCode;
183 foreach ($value as $v) {
184 $str .=
$key .
": " . $v .
"\r\n";
This interface represents a HTTP response.
This is the abstract base class for both the Request and Response objects.
getStatus()
Returns the current HTTP status code.
setStatus($status)
Sets the HTTP status code.
setBody($body)
Replaces the body resource with a new stream or string.
This class represents a single HTTP response.
getHeaders()
Returns all the HTTP headers as an array.
__construct($status=null, array $headers=null, $body=null)
Creates the response object.
getBodyAsString()
Returns the body as a string.
getStatusText()
Returns the human-readable status string.
setHeaders(array $headers)
Sets a new set of HTTP headers.
__toString()
Serializes the response object as a string.