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 |
getOriginalUri
([bool $clone =
TRUE])
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
([bool $clone =
TRUE])
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).
|
| void |
setEncoding
(array $encoding, string 1)
Recursively converts and checks encoding.
|
| 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 48 |
|
| protected string | $encoding | |
line 66 |
|
| protected array | $files | |
line 45 |
|
| protected array | $headers | |
line 57 HttpRequest::getHeaders() |
|
| protected Uri | $originalUri | |
line 54 HttpRequest::getOriginalUri() |
|
| protected array | $post | |
line 42 |
|
| protected array | $query | |
line 39 |
|
| protected UriScript | $uri | |
line 51 HttpRequest::getUri() |
|
| protected array | $uriFilter | array(
PHP_URL_PATH => array('#/{2,}#' => '/'),// '%20' => ''
0=>array(),//... |
line 60 |
|
| Method Details | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
line 111 addUriFilterpublic void addUriFilter (string $pattern, [string $replacement = Sets request URI filter.
|
||||||||||||||||||
|
line 675 detectLanguagepublic string detectLanguage ($langs) Parse Accept-Language header and returns prefered language.
|
||||||||||||||||||
|
line 141 detectUriprotected void detectUri () Detects uri, base path and script path of the request.
|
||||||||||||||||||
|
line 365 getCookiepublic mixed getCookie (string $key, [mixed $default = Returns variable provided to the script via HTTP cookies. Implementation of:
|
||||||||||||||||||
|
line 388 getCookiespublic array getCookies () Returns variables provided to the script via HTTP cookies. Implementation of:
|
||||||||||||||||||
|
line 325 getFilepublic HttpUploadedFile getFile (string $key) Returns uploaded file. Implementation of:
|
||||||||||||||||||
|
line 348 getFilespublic array getFiles () Returns uploaded files. Implementation of:
|
||||||||||||||||||
|
line 570 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 587 getHeaderspublic array getHeaders () Returns all HTTP headers. Implementation of:
|
||||||||||||||||||
|
line 533 getMethodpublic string getMethod () Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive. Implementation of:
|
||||||||||||||||||
|
line 94 getOriginalUripublic Uri getOriginalUri ([bool $clone = Returns URL object.
|
||||||||||||||||||
|
line 290 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 313 getPostRawpublic string getPostRaw () Returns HTTP POST data in raw format (only for "application/x-www-form-urlencoded"). Implementation of:
|
||||||||||||||||||
|
line 264 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 611 getRefererpublic Uri|NULL getReferer () Returns referrer.
|
||||||||||||||||||
|
line 645 getRemoteAddresspublic string getRemoteAddress () Returns the IP address of the remote client. Implementation of:
|
||||||||||||||||||
|
line 656 getRemoteHostpublic string getRemoteHost () Returns the host of the remote client. Implementation of:
|
||||||||||||||||||
|
line 79 getUripublic UriScript getUri ([bool $clone = Returns URL object. Implementation of:
|
||||||||||||||||||
|
line 130 getUriFilterspublic array getUriFilters () Returns request URI filter.
|
||||||||||||||||||
|
line 419 initializepublic void initialize () Initializes $this->query, $this->files, $this->cookies and $this->files arrays
|
||||||||||||||||||
|
line 634 isAjaxpublic bool isAjax () Is AJAX request? Implementation of:
|
||||||||||||||||||
|
line 545 isMethodpublic bool isMethod (string $method) Checks if the request method is the given one. Implementation of:
|
||||||||||||||||||
|
line 556 isPostpublic bool isPost () Checks if the request method is POST.
|
||||||||||||||||||
|
line 623 isSecuredpublic bool isSecured () Is the request is sent via secure channel (https). Implementation of:
|
||||||||||||||||||
|
line 405 setEncodingpublic void setEncoding (array $encoding, string 1) Recursively converts and checks encoding.
|
||||||||||||||||||
