HTTP headers manager.
More...
|
| | __construct ($raw_headers= '') |
| | Constructor. More...
|
| |
| | getHeadersArray () |
| | Returns HTTP headers array. More...
|
| |
| | addHeader ($name, $value) |
| | Adds new HTTP header. Does not replace headers with the same names. More...
|
| |
| | replaceHeader ($name, $value) |
| | Adds new HTTP header. Replaces headers with the same names. More...
|
| |
| | removeHeader ($name) |
| | Removes all HTTP headers with specified name, if any exist. More...
|
| |
|
| clearHeaders () |
| | Removes all HTTP headers.
|
| |
| | getHeader ($name) |
| | Returns first HTTP header with specified name. More...
|
| |
| | getHeaders ($name) |
| | Returns HTTP headers values array by header name. More...
|
| |
| | hasHeader ($name) |
| | Returns if there is HTTP header with specified name. More...
|
| |
| | getContentLength () |
| | Returns content length header value. More...
|
| |
| | isChunked () |
| | Returns true, if HTTP body contents is chunked. More...
|
| |
| | getAuthenticationType () |
| | Returns required HTTP authentication type (digest or basic). More...
|
| |
| | getAuthenticationOptions () |
| | Returns HTTP authentication options array. More...
|
| |
| | setBasicAuthenticationCredentials ($login, $password) |
| | Adds basic authentication header. More...
|
| |
| | setDigestAuthenticationCredentials (Array $auth_opts, $login, $password, $request_body, $http_method, $request_uri) |
| | Adds digest authentication header. More...
|
| |
| | getRawHeaders () |
| | Returns raw HTTP headers string. More...
|
| |
| __construct |
( |
|
$raw_headers = '' | ) |
|
Constructor.
- Parameters
-
| string | $raw_headers | Raw HTTP headers string |
| addHeader |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Adds new HTTP header. Does not replace headers with the same names.
- Parameters
-
| string | $name | Header name |
| string | $value | Header value |
| getAuthenticationOptions |
( |
| ) |
|
Returns HTTP authentication options array.
Example: Array('realm' => 'My Realm', 'qop' => 'auth', ...)
- Return values
-
| Array | HTTP authentication options array or null, if no authentication needed |
| getAuthenticationType |
( |
| ) |
|
Returns required HTTP authentication type (digest or basic).
- Return values
-
Returns content length header value.
- Return values
-
| int | Content length header value or null, if there is no such header |
Returns first HTTP header with specified name.
- Parameters
-
- Return values
-
| string | HTTP header value or null, if there is no header with specified name |
Returns HTTP headers values array by header name.
- Parameters
-
- Return values
-
| Array | HTTP headers array, which contains an Array ('header name' => ' header value') for each header |
Returns HTTP headers array.
- Return values
-
| Array | HTTP headers array, which contains an Array ('header name' => ' header value') for each header |
Returns raw HTTP headers string.
This string does not contain ending additional EOL.
- Return values
-
| string | HTTP Raw HTTP headers string |
Returns if there is HTTP header with specified name.
- Parameters
-
- Return values
-
| bool | True if there is HTTP header with specified name |
Returns true, if HTTP body contents is chunked.
- Return values
-
| bool | True if HTTP body contents is chunked |
Removes all HTTP headers with specified name, if any exist.
- Parameters
-
| replaceHeader |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Adds new HTTP header. Replaces headers with the same names.
- Parameters
-
| string | $name | Header name |
| string | $value | Header value |
| setBasicAuthenticationCredentials |
( |
|
$login, |
|
|
|
$password |
|
) |
| |
Adds basic authentication header.
- Parameters
-
| string | $login | Login |
| string | $password | Password |
| setDigestAuthenticationCredentials |
( |
Array |
$auth_opts, |
|
|
|
$login, |
|
|
|
$password, |
|
|
|
$request_body, |
|
|
|
$http_method, |
|
|
|
$request_uri |
|
) |
| |
Adds digest authentication header.
- Parameters
-
| Array | $auth_opts | Authentication data returned by getAuthenticationOptions |
| string | $login | Login |
| string | $password | Password |
| string | $request_body | Full body of request. Can be null if $auth_opts['qop'] != 'auth-int' |
| string | $http_method | Request HTTP method |
| string | $request_uri | Request URI |
- Exceptions
-
- Examples:
- manual_http_authentication.php.
The documentation for this class was generated from the following file: