namespace Nette\Web
Class HttpRequest
HttpRequest provides access scheme for request sent via HTTP.
- Nette\Object
-
Nette\Web\HttpRequest implements IHttpRequest
final public
UriScript
|
#
getUri(
)
Returns URL object. |
public
HttpRequest
|
#
setUri(
UriScript
$uri
)
Sets URL object. Sets URL object. Parameters$uri UriScriptReturnsHttpRequest provides a fluent interface
|
final public
Uri
|
#
getOriginalUri(
)
Returns URL object. Returns URL object. |
public
void
|
#
addUriFilter(
string
$pattern,
string
$replacement = '',
int
$component = NULL
)
Sets request URI filter. Sets request URI filter. Parameters$pattern string pattern to search for$replacement string string to replace$component int PHP_URL_PATH or NULL |
final public
array
|
#
getUriFilters(
)
Returns request URI filter. Returns request URI filter. |
protected
void
|
#
detectUri(
)
Detects uri, base path and script path of the request. Detects uri, base path and script path of the request. |
final public
mixed
|
#
getQuery(
string
$key = NULL,
mixed
$default = NULL
)
Returns variable provided to the script via URL query ($_GET). Returns variable provided to the script via URL query ($_GET). If no key is passed, returns the entire array. Parameters$key string key$default mixed default valueImplementation of |
final public
mixed
|
#
getPost(
string
$key = NULL,
mixed
$default = NULL
)
Returns variable provided to the script via POST method ($_POST). Returns variable provided to the script via POST method ($_POST). If no key is passed, returns the entire array. Parameters$key string key$default mixed default valueImplementation of |
public
string
|
#
getPostRaw(
)
Returns HTTP POST data in raw format (only for „application/x-www-form-urlencoded“). Returns HTTP POST data in raw format (only for „application/x-www-form-urlencoded“). Implementation of |
final public
HttpUploadedFile
|
#
getFile(
string
$key
)
Returns uploaded file. Returns uploaded file. Parameters$key string key (or more keys)Implementation of |
final public
array
|
#
getFiles(
)
Returns uploaded files. |
final public
mixed
|
#
getCookie(
string
$key,
mixed
$default = NULL
)
Returns variable provided to the script via HTTP cookies. Returns variable provided to the script via HTTP cookies. Parameters$key string key$default mixed default valueImplementation of |
final public
array
|
#
getCookies(
)
Returns variables provided to the script via HTTP cookies. Returns variables provided to the script via HTTP cookies. Implementation of |
public
HttpRequest
|
#
setEncoding(
array
$encoding
)
Recursively converts and checks encoding. Recursively converts and checks encoding. Parameters$encoding arrayReturnsHttpRequest provides a fluent interface
|
public
void
|
#
initialize(
)
Initializes $this->query, $this->files, $this->cookies and $this->files arrays. Initializes $this->query, $this->files, $this->cookies and $this->files arrays. |
public
string
|
#
getMethod(
)
Returns HTTP request method (GET, POST, HEAD, PUT, …). The method is case-sensitive. Returns HTTP request method (GET, POST, HEAD, PUT, …). The method is case-sensitive. Implementation of |
public
bool
|
#
isMethod(
string
$method
)
Checks if the request method is the given one. Checks if the request method is the given one. Parameters$method stringImplementation of |
public
bool
|
#
isPost(
)
Checks if the request method is POST. Checks if the request method is POST. |
final public
mixed
|
#
getHeader(
string
$header,
mixed
$default = NULL
)
Return the value of the HTTP header. Pass the header name as the Return the value of the HTTP header. Pass the header name as the plain, HTTP-specified header name (e.g. ‚Accept-Encoding‘). Parameters$header string$default mixedImplementation of |
public
array
|
#
getHeaders(
)
Returns all HTTP headers. |
final public
Uri|NULL
|
#
getReferer(
)
Returns referrer. Returns referrer. |
public
bool
|
#
isSecured(
)
Is the request is sent via secure channel (https). |
public
bool
|
#
isAjax(
)
Is AJAX request? |
public
string
|
#
getRemoteAddress(
)
Returns the IP address of the remote client. |
public
string
|
#
getRemoteHost(
)
Returns the host of the remote client. |
public
string
|
#
detectLanguage(
array
$langs
)
Parse Accept-Language header and returns prefered language. Parse Accept-Language header and returns prefered language. Parameters$langs array Supported languages |
Methods Inherited From Nette\Object
getReflection(), __call(), __callStatic(), extensionMethod(), __get(), __set(), __isset(), __unset()
protected
array
|
$query | NULL |
# |
protected
array
|
$post | NULL |
# |
protected
array
|
$files | NULL |
# |
protected
array
|
$cookies | NULL |
# |
protected
UriScript
|
$uri | NULL |
{@link HttpRequest::getUri()} # |
protected
Uri
|
$originalUri | NULL |
{@link HttpRequest::getOriginalUri()} # |
protected
array
|
$headers | NULL |
{@link HttpRequest::getHeaders()} # |
protected
array
|
$uriFilter | array ( 5 => array ( '#/{2,}#' => '/', ), 0 => array ( ), ) |
# |
protected
string
|
$encoding | NULL |
# |