Controller/Request/Http.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to
[email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Controller
- Version
- $Id$
\Zend_Controller_Request_Http
Package: Zend_Controller\RequestZend_Controller_Request_Http
HTTP request object for use with Zend_Controller family.
- Parent(s)
- \Zend_Controller_Request_Abstract
- Children
- \Zend_Controller_Request_Apache404
- \Zend_Controller_Request_HttpTestCase
- Uses
-
Constants
Properties
array $_aliases = array()
Alias keys for request parameters
Default valuearray()
Details- Type
- array
array $_paramSources = array('_GET', '_POST')
Allowed parameter sources
Default valuearray('_GET', '_POST')
Details- Type
- array
Methods
__get(string $key) : mixed
Access values contained in the superglobals as public members
Order of precedence: 1. GET, 2. POST, 3. COOKIE, 4. SERVER, 5. ENV
ParametersName | Type | Description |
---|
$key | string | |
---|
ReturnsDetails- See
-
__isset(string $key) : boolean
Check to see if a property is set
ParametersName | Type | Description |
---|
$key | string | |
---|
Returns getClientIp(boolean $checkProxy = true) : string
Get the client's IP addres
ParametersName | Type | Description |
---|
$checkProxy | boolean | |
---|
Returns getCookie(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_COOKIE superglobal
If no $key is passed, returns the entire $_COOKIE array.
ParametersName | Type | Description |
---|
$key | string | |
---|
$default | mixed | Default value to use if key not found |
---|
ReturnsType | Description |
---|
mixed | Returns null if key does not exist |
Details- Todo
- How to retrieve from nested arrays
getEnv(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_ENV superglobal
If no $key is passed, returns the entire $_ENV array.
ParametersName | Type | Description |
---|
$key | string | |
---|
$default | mixed | Default value to use if key not found |
---|
ReturnsType | Description |
---|
mixed | Returns null if key does not exist |
getHeader(string $header) : string | false
Return the value of the given HTTP header. Pass the header name as the
plain, HTTP-specified header name. Ex.: Ask for 'Accept' to get the
Accept header, 'Accept-Encoding' to get the Accept-Encoding header.
ParametersName | Type | Description |
---|
$header | string | HTTP header name |
---|
ReturnsType | Description |
---|
string | false | HTTP header value, or false if not found |
Throws getParam(mixed $key, mixed $default = null) : mixed
Retrieves a parameter from the instance. Priority is in the order of
userland parameters (see {@link setParam()}), $_GET, $_POST. If a
parameter matching the $key is not found, null is returned.
If the $key is an alias, the actual key aliased will be used.
ParametersName | Type | Description |
---|
$key | mixed | |
---|
$default | mixed | Default value to use if key not found |
---|
ReturnsgetParams() : array
Retrieve an array of parameters
Retrieves a merged array of parameters, with precedence of userland
params (see {@link setParam()}), $_GET, $_POST (i.e., values in the
userland params will take precedence over all others).
ReturnsgetPathInfo() : string
Returns everything between the BaseUrl and QueryString.
This value is calculated instead of reading PATH_INFO
directly from $_SERVER due to cross-platform differences.
ReturnsgetPost(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_POST superglobal
If no $key is passed, returns the entire $_POST array.
ParametersName | Type | Description |
---|
$key | string | |
---|
$default | mixed | Default value to use if key not found |
---|
ReturnsType | Description |
---|
mixed | Returns null if key does not exist |
Details- Todo
- How to retrieve from nested arrays
getQuery(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_GET superglobal
If no $key is passed, returns the entire $_GET array.
ParametersName | Type | Description |
---|
$key | string | |
---|
$default | mixed | Default value to use if key not found |
---|
ReturnsType | Description |
---|
mixed | Returns null if key does not exist |
Details- Todo
- How to retrieve from nested arrays
getRawBody() : string | false
Return the raw body of the request, if present
ReturnsType | Description |
---|
string | false | Raw body, or false if not present |
getServer(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_SERVER superglobal
If no $key is passed, returns the entire $_SERVER array.
ParametersName | Type | Description |
---|
$key | string | |
---|
$default | mixed | Default value to use if key not found |
---|
ReturnsType | Description |
---|
mixed | Returns null if key does not exist |
isXmlHttpRequest() : boolean
Is the request a Javascript XMLHttpRequest?
Should work with Prototype/Script.aculo.us, possibly others.
ReturnssetBasePath(string | null $basePath = null) : \Zend_Controller_Request_Http
Set the base path for the URL
ParametersName | Type | Description |
---|
$basePath | string | null | |
---|
Returns setBaseUrl(mixed $baseUrl = null) : \Zend_Controller_Request_Http
Set the base URL of the request; i.e., the segment leading to the script name
E.g.:
- /admin
- /myapp
- /subdir/index.php
Do not use the full URI when providing the base. The following are
examples of what not to use:
- http://example.com/admin (should be just /admin)
- http://example.com/subdir/index.php (should be just /subdir/index.php)
If no $baseUrl is provided, attempts to determine the base URL from the
environment, using SCRIPT_FILENAME, SCRIPT_NAME, PHP_SELF, and
ORIG_SCRIPT_NAME in its determination.
ParametersName | Type | Description |
---|
$baseUrl | mixed | |
---|
ReturnssetParamSources( $paramSources = array()) : \Zend_Controller_Request_Http
Set allowed parameter sources
Can be empty array, or contain one or more of '_GET' or '_POST'.
ParametersName | Type | Description |
---|
$paramSources | | |
---|
ReturnssetRequestUri(string $requestUri = null) : \Zend_Controller_Request_Http
Set the REQUEST_URI on which the instance operates
If no request URI is passed, uses the value in $_SERVER['REQUEST_URI'],
$_SERVER['HTTP_X_REWRITE_URL'], or $_SERVER['ORIG_PATH_INFO'] + $_SERVER['QUERY_STRING'].
ParametersName | Type | Description |
---|
$requestUri | string | |
---|
Returns