Request
class Request implements IRequest
HttpRequest provides access scheme for request sent via HTTP.
Properties
| UrlScript read-only | $url | ||
| array read-only | $query | ||
| array read-only | $post | ||
| array read-only | $files | ||
| array read-only | $cookies | ||
| string read-only | $method | ||
| array read-only | $headers | ||
| UrlImmutable|null read-only | $referer | ||
| bool read-only | $secured | ||
| bool read-only | $ajax | ||
| string|null read-only | $remoteAddress | ||
| string|null read-only | $remoteHost | ||
| string|null read-only | $rawBody | 
Methods
No description
Returns variable provided to the script via URL query ($_GET).
Returns variable provided to the script via POST method ($_POST).
Returns uploaded file.
Returns tree of upload files in a normalized structure, with each leaf an instance of Nette\Http\FileUpload.
Returns a cookie or null if it does not exist.
Returns all cookies.
Returns the HTTP method with which the request was made (GET, POST, HEAD, PUT, ...).
Checks the HTTP method with which the request was made. The parameter is case-insensitive.
Returns an HTTP header or null if it does not exist. The parameter is case-insensitive.
Returns all HTTP headers as associative array.
Returns referrer.
What origin did the user come from? It contains scheme, hostname and port.
Is the request sent via secure channel (https)?
Is the request coming from the same site and is initiated by clicking on a link?
Is it an AJAX request?
Returns the IP address of the remote client.
Returns the host of the remote client.
Returns raw content of HTTP request body.
Returns decoded content of HTTP request body.
Returns basic HTTP authentication credentials.
Returns the most preferred language by browser. Uses the Accept-Language header. If no match is reached, it returns null.
Details
        at line 43
                            
    __construct(UrlScript $url, array $post = [], array $files = [], array $cookies = [], array $headers = [], string $method = 'GET', string|null $remoteAddress = null, string|null $remoteHost = null, callable|null $rawBodyCallback = null)
        
    
    No description
        at line 73
                            UrlScript
    getUrl()
        
    
    Returns the URL of the request.
        at line 86
                            mixed
    getQuery(string|null $key = null)
        
    
    Returns variable provided to the script via URL query ($_GET).
If no key is passed, returns the entire array.
        at line 100
                            mixed
    getPost(string|null $key = null)
        
    
    Returns variable provided to the script via POST method ($_POST).
If no key is passed, returns the entire array.
        at line 114
                            FileUpload|null
    getFile(string $key)
        
    
    Returns uploaded file.
        at line 124
                            array
    getFiles()
        
    
    Returns tree of upload files in a normalized structure, with each leaf an instance of Nette\Http\FileUpload.
        at line 133
                            mixed
    getCookie(string $key)
        
    
    Returns a cookie or null if it does not exist.
        at line 142
                            array
    getCookies()
        
    
    Returns all cookies.
        at line 154
                            string
    getMethod()
        
    
    Returns the HTTP method with which the request was made (GET, POST, HEAD, PUT, ...).
        at line 163
                            bool
    isMethod(string $method)
        
    
    Checks the HTTP method with which the request was made. The parameter is case-insensitive.
        at line 172
                            string|null
    getHeader(string $header)
        
    
    Returns an HTTP header or null if it does not exist. The parameter is case-insensitive.
        at line 182
                            array
    getHeaders()
        
    
    Returns all HTTP headers as associative array.
        at line 188
                            UrlImmutable|null
    getReferer()
        
    
    Returns referrer.
        at line 201
                            UrlImmutable|null
    getOrigin()
        
    
    What origin did the user come from? It contains scheme, hostname and port.
        at line 217
                            bool
    isSecured()
        
    
    Is the request sent via secure channel (https)?
        at line 226
                            bool
    isSameSite()
        
    
    Is the request coming from the same site and is initiated by clicking on a link?
        at line 235
                            bool
    isAjax()
        
    
    Is it an AJAX request?
        at line 244
                            string|null
    getRemoteAddress()
        
    
    Returns the IP address of the remote client.
        at line 253
                            string|null
    getRemoteHost()
        
    
    Returns the host of the remote client.
        at line 262
                            string|null
    getRawBody()
        
    
    Returns raw content of HTTP request body.
        at line 271
                            mixed
    getDecodedBody()
        
    
    Returns decoded content of HTTP request body.
        at line 286
                            array|null
    getBasicCredentials()
        
    
    Returns basic HTTP authentication credentials.
        at line 305
                            string|null
    detectLanguage(array $langs)
        
    
    Returns the most preferred language by browser. Uses the Accept-Language header. If no match is reached, it returns null.