Class HttpRequest (namespace Nette\Web)
HttpRequest provides access scheme for request sent via HTTP.
Object | --HttpRequest
Implements interfaces:
Public Method Summary | |
---|---|
void |
Sets request URI filter.
|
string |
detectLanguage
($langs)
Parse Accept-Language header and returns prefered language.
|
mixed |
getCookie
(string $key, [mixed $default =
NULL ])
Returns variable provided to the script via HTTP cookies.
|
array |
getCookies
()
Returns variables provided to the script via HTTP cookies.
|
HttpUploadedFile |
getFile
(string $key)
Returns uploaded file.
|
array |
getFiles
()
Returns uploaded files.
|
mixed |
getHeader
(string $header, [mixed $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.
|
string |
getMethod
()
Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.
|
Uri |
Returns URL object.
|
mixed |
Returns variable provided to the script via POST method ($_POST).
|
string |
getPostRaw
()
Returns HTTP POST data in raw format (only for "application/x-www-form-urlencoded").
|
mixed |
Returns variable provided to the script via URL query ($_GET).
|
Uri|NULL |
getReferer
()
Returns referrer.
|
string |
Returns the IP address of the remote client.
|
string |
Returns the host of the remote client.
|
UriScript |
getUri
()
Returns URL object.
|
array |
Returns request URI filter.
|
void |
initialize
()
Initializes $this->query, $this->files, $this->cookies and $this->files arrays
|
bool |
isAjax
()
Is AJAX request?
|
bool |
isMethod
(string $method)
Checks if the request method is the given one.
|
bool |
isPost
()
Checks if the request method is POST.
|
bool |
isSecured
()
Is the request is sent via secure channel (https).
|
HttpRequest |
setEncoding
(array $encoding, string 1)
Recursively converts and checks encoding.
|
HttpRequest |
Sets URL object.
|
Protected Method Summary | |
---|---|
protected void |
detectUri
()
Detects uri, base path and script path of the request.
|
Methods Inherited From Object |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Variable Summary | ||||
---|---|---|---|---|
protected array | $cookies |
|
line 61 |
|
protected string | $encoding |
|
line 79 |
|
protected array | $files |
|
line 58 |
|
protected array | $headers |
|
line 70 HttpRequest::getHeaders() |
|
protected Uri | $originalUri |
|
line 67 HttpRequest::getOriginalUri() |
|
protected array | $post |
|
line 55 |
|
protected array | $query |
|
line 52 |
|
protected UriScript | $uri |
|
line 64 HttpRequest::getUri() |
|
protected array | $uriFilter | array(
PHP_URL_PATH => array('#/{2,}#' => '/'),// '%20' => ''
0=>array(),//... |
line 73 |
Method Details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 138 addUriFilterpublic void addUriFilter (string $pattern, [string $replacement = Sets request URI filter.
|
||||||||||||||||||
line 692 detectLanguagepublic string detectLanguage ($langs) Parse Accept-Language header and returns prefered language.
|
||||||||||||||||||
line 168 detectUriprotected void detectUri () Detects uri, base path and script path of the request.
|
||||||||||||||||||
line 383 getCookiepublic mixed getCookie (string $key, [mixed $default = Returns variable provided to the script via HTTP cookies. Implementation of:
|
||||||||||||||||||
line 406 getCookiespublic array getCookies () Returns variables provided to the script via HTTP cookies. Implementation of:
|
||||||||||||||||||
line 351 getFilepublic HttpUploadedFile getFile (string $key) Returns uploaded file. Implementation of:
|
||||||||||||||||||
line 366 getFilespublic array getFiles () Returns uploaded files. Implementation of:
|
||||||||||||||||||
line 587 getHeaderpublic mixed getHeader (string $header, [mixed $default = Return the value of the HTTP header. Pass the header name as the plain, HTTP-specified header name (e.g. 'Accept-Encoding'). Implementation of:
|
||||||||||||||||||
line 604 getHeaderspublic array getHeaders () Returns all HTTP headers. Implementation of:
|
||||||||||||||||||
line 550 getMethodpublic string getMethod () Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive. Implementation of:
|
||||||||||||||||||
line 121 getOriginalUripublic Uri getOriginalUri () Returns URL object.
|
||||||||||||||||||
line 316 getPostpublic mixed getPost ([string $key = Returns variable provided to the script via POST method ($_POST). If no key is passed, returns the entire array. Implementation of:
|
||||||||||||||||||
line 339 getPostRawpublic string getPostRaw () Returns HTTP POST data in raw format (only for "application/x-www-form-urlencoded"). Implementation of:
|
||||||||||||||||||
line 290 getQuerypublic mixed getQuery ([string $key = Returns variable provided to the script via URL query ($_GET). If no key is passed, returns the entire array. Implementation of:
|
||||||||||||||||||
line 628 getRefererpublic Uri|NULL getReferer () Returns referrer.
|
||||||||||||||||||
line 662 getRemoteAddresspublic string getRemoteAddress () Returns the IP address of the remote client. Implementation of:
|
||||||||||||||||||
line 673 getRemoteHostpublic string getRemoteHost () Returns the host of the remote client. Implementation of:
|
||||||||||||||||||
line 91 getUripublic UriScript getUri () Returns URL object. Implementation of:
|
||||||||||||||||||
line 157 getUriFilterspublic array getUriFilters () Returns request URI filter.
|
||||||||||||||||||
line 438 initializepublic void initialize () Initializes $this->query, $this->files, $this->cookies and $this->files arrays
|
||||||||||||||||||
line 651 isAjaxpublic bool isAjax () Is AJAX request? Implementation of:
|
||||||||||||||||||
line 562 isMethodpublic bool isMethod (string $method) Checks if the request method is the given one. Implementation of:
|
||||||||||||||||||
line 573 isPostpublic bool isPost () Checks if the request method is POST.
|
||||||||||||||||||
line 640 isSecuredpublic bool isSecured () Is the request is sent via secure channel (https). Implementation of:
|
||||||||||||||||||
line 423 setEncodingpublic HttpRequest setEncoding (array $encoding, string 1) Recursively converts and checks encoding.
|
||||||||||||||||||
line 106 setUripublic HttpRequest setUri (UriScript $uri) Sets URL object.
|