This class represents one HTTP request.
It's modelled quite much after Java's ServletAPI. So if you've used Java you will feel at home.
Located in /Request.php (line 38)
The default locale (eg. en-us) the application uses.
All the headers.
The context path parameters in an indexed array.
The context path parameters in an associative array.
The locales (eg. en-us, fi_fi, se_se etc) the application supports.
The constructor.
Gets the used character encoding.
Returns the name of the character encoding used in the body of this request.
Gets the content length.
Returns the length, in bytes, of the request body or -1 if the length is not known.
Gets the content type.
Returns the MIME type of the body of the request or NULL if the type is not known.
Returns the context path.
Returns the portion of the request URI that indicates the context of the request.
Example
- // if the request is done to http://foo/bar.php/name/value
- $contextPath = $this->getContextPath();
Gets the available cookies.
Returns an associative array containing all of the cookies objects the client sent with this request.
Gets the default locale for the application.
Gets the value of header.
Returns the value of the specified request header.
Gets all the header names.
Returns an array of all the header names this request contains.
Gets all the headers.
Returns an associative array of all the header names and values of this request.
Gets the ip address.
Returns the Internet Protocol (IP) address of the client that sent the request. Different from getRemoteAddress, also checks for HTTP_CLIENT_IP and HTTP_X_FORWARD_FOR
Deduces the clients preferred locale.
You might want to override this method if you want to do more sophisticated decisions. It gets the supported locales and the default locale from the class attributes file and tries to find a match. If no match is found it uses the default locale. The locale is always changed into lowercase.
Gets the request method.
Returns the name of the HTTP method with which this request was made., for example, GET, POST, or PUT.
Returns the parameter from the request parameters if it's available.
Parameters can come from different sources. Get parameters are the result of a HTTP GET operation, post parameters are the result of a HTTP POST operation, cookie parameters are the parameters given by the cookies stored in the client browser for this domain and request parameters are a combination of all the earlier types combined according to the variables_order configuration directive.
One has to choose what type of parameter to get with the second parameter to this method.
Note that the returned value can be an array if the parameter has multiple values.
Returns an array containing the name-value pair of the parameters.
It defauls to returning an array for the GET parameters if nothing else is specified.
Returns the names of the available parameters.
This returns an array containing the names of the available parameters. It defauls to returning an array for the GET parameters if nothing else is specified.
Returns the path info parameter from the request.
This returns the next value after the first occurrence of $name in the path info string for this request.
Example:
- // the url is http://foo/bar.php/name1/value1/name2/value2
- $v = $this->request->getPathParameter('name1');
Everything after bar.php above is treated as path info parameters and a search from the beginning to the end is made and the value after the first match is returned.
Returns the path info parameter from the request at the specified position.
Returns the value at the given position in the path info or null if no such parameter exists. The first parameter is at position 0, the second one at position 1 etc.
Example:
- // the url is http://foo/bar.php/name1/value1/name2/value2
- $v = $this->request->getPathParameterAt(0);
- // $v is now 'name1'
- $v = $this->request->getPathParameterAt(3);
Everything after bar.php above is treated as path info parameters and a search from the beginning to the end is made and the value after the first match is returned.
Returns the path info parameters from the request in an indexed array.
Returns the path info parameters from the request in an associative array.
Gets the protocol.
Returns the name and version of the protocol the request uses in the form protocol/majorVersion/minorVersion, for example HTTP/1.1
Gets the query string.
Returns the query string this is contained in the request URL after the path.
Gets the remove address.
Returns the Internet Protocol (IP) address of the client that sent the request.
Gets the remove host.
Returns the fully qualified name of the client that sent the request.
This is figured out by doing a dns server lookup of the ip address. If no host is associated with the address NULL is returned.
Gets the server name.
Returns the host name of the server that received the request.
Gets the port number.
Returns the port number on which this request was received.
Gets the supported locales for the application.
Checks if a path parameter is set.
This tests if a variable named $name is set in the path info string for this request.
Indicates wheather the current request is secure or not.
Returns a boolean indication wheather this request was made using a secute channel, such as HTTPS.
Sets the default locale for the application.
Create an instance of
manually and set the default locale with this method. Then add it as the application's request class with
.
Sets the locales supported by the application.
Create an instance of
manually and set the supported locales with this method. Then add it as the application's request class with
.
Returns all HTTP_* headers.
Returns all the HTTP_* headers. Works both if PHP is an apache module and if it's running as a CGI.
Helper function for my_getallheaders.
For use with array_walk.
Documentation generated on Mon, 14 Jun 2004 11:59:32 +0200 by phpDocumentor 1.3.0RC3