interface IRequest

IHttpRequest provides access scheme for request sent via HTTP.

Constants

GET

HTTP request method

POST

HTTP request method

HEAD

HTTP request method

PUT

HTTP request method

DELETE

HTTP request method

PATCH

HTTP request method

OPTIONS

HTTP request method

Methods

getUrl()

Returns URL object.

mixed
getQuery($key = null, $default = null)

Returns variable provided to the script via URL query ($_GET).

mixed
getPost($key = null, $default = null)

Returns variable provided to the script via POST method ($_POST).

FileUpload|array|null
getFile($key)

Returns uploaded file.

array
getFiles()

Returns uploaded files.

mixed
getCookie($key, $default = null)

Returns variable provided to the script via HTTP cookies.

array
getCookies()

Returns variables provided to the script via HTTP cookies.

string
getMethod()

Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.

bool
isMethod($method)

Checks HTTP request method.

string|null
getHeader($header, $default = null)

Return the value of the HTTP header. Pass the header name as the plain, HTTP-specified header name (e.g. 'Accept-Encoding').

array
getHeaders()

Returns all HTTP headers.

bool
isSecured()

Is the request sent via secure channel (https)?

bool
isAjax()

Is AJAX request?

string|null
getRemoteAddress()

Returns the IP address of the remote client.

string|null
getRemoteHost()

Returns the host of the remote client.

string|null
getRawBody()

Returns raw content of HTTP request body.

Details

at line 30
UrlScript getUrl()

Returns URL object.

Return Value

UrlScript

at line 41
mixed getQuery($key = null, $default = null)

Returns variable provided to the script via URL query ($_GET).

If no key is passed, returns the entire array.

Parameters

$key
$default

Return Value

mixed

at line 50
mixed getPost($key = null, $default = null)

Returns variable provided to the script via POST method ($_POST).

If no key is passed, returns the entire array.

Parameters

$key
$default

Return Value

mixed

at line 57
FileUpload|array|null getFile($key)

Returns uploaded file.

Parameters

$key

Return Value

FileUpload|array|null

at line 63
array getFiles()

Returns uploaded files.

Return Value

array

at line 71
mixed getCookie($key, $default = null)

Returns variable provided to the script via HTTP cookies.

Parameters

$key
$default

Return Value

mixed

at line 77
array getCookies()

Returns variables provided to the script via HTTP cookies.

Return Value

array

at line 85
string getMethod()

Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.

Return Value

string

at line 92
bool isMethod($method)

Checks HTTP request method.

Parameters

$method

Return Value

bool

at line 101
string|null getHeader($header, $default = null)

Return the value of the HTTP header. Pass the header name as the plain, HTTP-specified header name (e.g. 'Accept-Encoding').

Parameters

$header
$default

Return Value

string|null

at line 107
array getHeaders()

Returns all HTTP headers.

Return Value

array

at line 113
bool isSecured()

Is the request sent via secure channel (https)?

Return Value

bool

at line 119
bool isAjax()

Is AJAX request?

Return Value

bool

at line 125
string|null getRemoteAddress()

Returns the IP address of the remote client.

Return Value

string|null

at line 131
string|null getRemoteHost()

Returns the host of the remote client.

Return Value

string|null

at line 137
string|null getRawBody()

Returns raw content of HTTP request body.

Return Value

string|null