The AnewtRequest class contains request information.
The AnewtRequest class contains request information.
This class provides several static methods that can be used to get information about the current HTTP request.
These method can be used to find out various forms of the request url, e.g. relative and absolute urls, domain names, and so on.
static url($include_query_string=true) [static] ¶Alias for AnewtRequest::relative_url().
$include_query_stringWhether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true)
The relative URL for the current request.
static relative_url($include_query_string=true) [static] ¶Returns the relative URL for the current request.
$include_query_stringWhether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true)
The relative URL for the current request.
static canonical_url($include_query_string=true) [static] ¶Returns the canonical URL for the current request.
This includes the http part, the hostname and (optionally) port number.
$include_query_stringWhether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true)
The canonical URL for the current request.
static canonical_base_url() [static] ¶Returns the canonical base URL for the current request.
This includes the http part, the hostname and (optionally) port number.
The canonical base URL for the current request.
static host() [static] ¶Returns the hostname as provided in the server configuration.
Host name for the current request.
static http_host() [static] ¶Returns the host name as provided in the client's HTTP Host header.
Note that this value should be treated as unsafe, since it's user-provided.
Host name for the current request.
static domain() [static] ¶Return the domain name for the current request.
Heuristics are used to detect the the domain name. This will fail horribly for extremely short domain names. A domain name is assumed to be the rightmost part of the full hostname. A test on very short strings is used to detect top level domains such as .com, .nl and double ones like .co.uk. This obviously fails for longer top level domains and extremely short domain names.
Domain name for the current request.
static referer() [static] ¶Return the HTTP referer of the current request, if any.
This method uses the HTTP_REFERER header in the HTTP request, and will return null if no referer was set.
The refererring url of the current request, or null.
These methods allow you to find out the request method of the current request, and offers various type-safe methods to extract values from GET and POST parameters and cookies.
static method() [static] ¶Returns the method type of this request (GET or POST).
A string telling which type of request this is. This can be either 'GET' or 'POST'.
static is_get() [static] ¶Check if the request is a HTTP GET request.
True if the request is a GET request, false otherwise.
static is_post() [static] ¶Check if the request is a HTTP POST request.
True if the request is a POST request, false otherwise.
static get_int($key, $default=null) [static] ¶Get an integer from the GET request data.
$keyThe name of the integer.
$defaultThe default value to return if no valid integer was found. If you omit this parameter, null is used.
A valid integer or the default value.
static post_int($key, $default=null) [static] ¶Gets an integer from the POST request data.
$keyThe name of the integer.
$defaultThe default value to return if no valid integer was found. If you omit this parameter, null is used.
A valid integer or the default value.
static cookie_int($key, $default=null) [static] ¶Gets an integer from the COOKIE data.
$keyThe name of the integer.
$defaultThe default value to return if no valid integer was found. If you omit this parameter, null is used.
A valid integer or the default value.
static get_string($key, $default=null) [static] ¶Gets a string from the GET request data.
$keyThe name of the string.
$defaultThe default value to return if no string was found. If you omit this parameter, null is used.
A string or the default value.
static post_string($key, $default=null) [static] ¶Gets a string from the POST request data.
$keyThe name of the string.
$defaultThe default value to return if no string was found. If you omit this parameter, null is used.
A string or the default value.
static cookie_string($key, $default=null) [static] ¶Gets a string from the COOKIE data.
$keyThe name of the string.
$defaultThe default value to return if no string was found. If you omit this parameter, null is used.
A string or the default value.
static get_bool($key, $default=null) [static] ¶Gets a boolean value from the GET data.
$keyThe name of the boolean.
$defaultThe default value to return if no valid boolean was found. If you omit this parameter, null is used.
A string or the default value.
static post_bool($key, $default=null) [static] ¶Gets a boolean value from the POST data.
$keyThe name of the boolean.
$defaultThe default value to return if no valid boolean was found. If you omit this parameter, null is used.
A string or the default value.
static cookie_bool($key, $default=null) [static] ¶Gets a boolean value from the COOKIE data.
$keyThe name of the boolean.
$defaultThe default value to return if no valid boolean was found. If you omit this parameter, null is used.
A string or the default value.