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 license@zend.com so we can send you a copy immediately.
Zend_Controller_Request_Http
HTTP request object for use with Zend_Controller family.
SCHEME_HTTP = 'http'
Scheme for http
SCHEME_HTTPS = 'https'
Scheme for https
array $_aliases = 'array'
Alias keys for request parameters
string $_basePath = 'null'
Base path of request
string $_baseUrl = 'null'
Base URL of request
array $_paramSources = 'array'
Allowed parameter sources
array $_params = 'array'
Instance parameters
string $_pathInfo = ''
PATH_INFO
string|false $_rawBody = ''
Raw request body
string; $_requestUri = ''
REQUEST_URI
__construct(
string|Zend_Uri $uri
=
null
)
:
void
Constructor
If a $uri is passed, the object will attempt to populate itself using that information.
__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
__isset(
string $key
)
:
boolean
Check to see if a property is set
__set(
string $key, mixed $value
)
:
void
Set values
In order to follow {@link __get()}, which operates on a number of superglobals, setting values through overloading is not allowed and will raise an exception. Use setParam() instead.
get(
string $key
)
:
mixed
Alias to __get
getAlias(
string $name
)
:
string|null
Retrieve an alias
Retrieve the actual key represented by the alias $name.
getAliases(
)
:
array
Retrieve the list of all aliases
getBasePath(
)
:
string
Everything in REQUEST_URI before PATH_INFO not including the filename <img src="<?=$basePath?>/images/zend.png"/>
getBaseUrl(
)
:
string
Everything in REQUEST_URI before PATH_INFO <form action="<?=$baseUrl?>/news/submit" method="POST"/>
getClientIp(
boolean $checkProxy
=
true
)
:
string
Get the client's IP addres
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.
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.
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.
getHttpHost(
)
:
string
Get the HTTP host.
"Host" ":" host [ ":" port ] ; Section 3.2.2 Note the HTTP Host header is not the same as the URI host. It includes the port while the URI host doesn't.
getMethod(
)
:
string
Return the method by which the request was made
getParam(
mixed $key, mixed $default
=
null
)
:
mixed
Retrieve a parameter
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.
getParamSources(
)
:
array
Get list of allowed parameter sources
getParams(
)
:
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).
getPathInfo(
)
:
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.
getPost(
string $key
=
null, mixed $default
=
null
)
:
mixed
Retrieve a member of the $_POST superglobal
If no $key is passed, returns the entire $_POST array.
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.
getRawBody(
)
:
string|false
Return the raw body of the request, if present
getRequestUri(
)
:
string
Returns the REQUEST_URI taking into account platform differences between Apache and IIS
getScheme(
)
:
string
Get the request URI scheme
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.
has(
string $key
)
:
boolean
Alias to __isset()
isDelete(
)
:
boolean
Was the request made by DELETE?
isFlashRequest(
)
:
boolean
Is this a Flash request?
isGet(
)
:
boolean
Was the request made by GET?
isHead(
)
:
boolean
Was the request made by HEAD?
isOptions(
)
:
boolean
Was the request made by OPTIONS?
isPost(
)
:
boolean
Was the request made by POST?
isPut(
)
:
boolean
Was the request made by PUT?
isSecure(
)
:
boolean
Is https secure request
isXmlHttpRequest(
)
:
boolean
Is the request a Javascript XMLHttpRequest?
Should work with Prototype/Script.aculo.us, possibly others.
set(
string $key, mixed $value
)
:
void
Alias to __set()
setAlias(
string $name, string $target
)
:
Zend_Controller_Request_Http
Set a key alias
Set an alias used for key lookups. $name specifies the alias, $target specifies the actual key to use.
setBasePath(
string|null $basePath
=
null
)
:
Zend_Controller_Request_Http
Set the base path for the URL
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.
setParam(
mixed $key, mixed $value
)
:
Zend_Controller_Request_Http
Set a userland parameter
Uses $key to set a userland parameter. If $key is an alias, the actual key will be retrieved and used to set the parameter.
setParamSources(
$paramSources
=
array
)
:
Zend_Controller_Request_Http
Set allowed parameter sources
Can be empty array, or contain one or more of '_GET' or '_POST'.
setParams(
array $params
)
:
Zend_Controller_Request_Http
Set parameters
Set one or more parameters. Parameters are set as userland parameters, using the keys specified in the array.
setPathInfo(
string|null $pathInfo
=
null
)
:
Zend_Controller_Request_Http
Set the PATH_INFO string
setPost(
string|array $spec, null|mixed $value
=
null
)
:
Zend_Controller_Request_Http
Set POST values
setQuery(
string|array $spec, null|mixed $value
=
null
)
:
Zend_Controller_Request_Http
Set GET values
setRequestUri(
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'].