Class Zend_Controller_Request_Http

Description

Zend_Controller_Request_Http

HTTP request object for use with Zend_Controller family.

Located in /Controller/Request/Http.php (line 37)

Zend_Controller_Request_Abstract
   |
   --Zend_Controller_Request_Http
Direct descendents
Class Description
 class Zend_Controller_Request_Apache404 Zend_Controller_Request_Apache404
 class Zend_Controller_Request_HttpTestCase Zend_Controller_Request_HttpTestCase
Class Constant Summary
 SCHEME_HTTP = 'http'
 SCHEME_HTTPS = 'https'
Variable Summary
 array $_aliases
 string $_basePath
 string $_baseUrl
 array $_params
 string $_pathInfo
 string|false $_rawBody
 string; $_requestUri
Method Summary
 void __construct ([string|Zend_Uri $uri = null])
 mixed get (string $key)
 string|null getAlias (string $name)
 array getAliases ()
 string getBasePath ()
 string getBaseUrl ()
 string getClientIp ([boolean $checkProxy = true])
 mixed getCookie ([string $key = null], [mixed $default = null])
 mixed getEnv ([string $key = null], [mixed $default = null])
 string|false getHeader (string $header)
 string getHttpHost ()
 string getMethod ()
 mixed getParam (mixed $key, [mixed $default = null])
 array getParams ()
 array getParamSources ()
 string getPathInfo ()
 mixed getPost ([string $key = null], [mixed $default = null])
 mixed getQuery ([string $key = null], [mixed $default = null])
 string|false getRawBody ()
 string getRequestUri ()
 string getScheme ()
 mixed getServer ([string $key = null], [mixed $default = null])
 boolean has (string $key)
 boolean isDelete ()
 boolean isFlashRequest ()
 boolean isGet ()
 boolean isHead ()
 boolean isOptions ()
 boolean isPost ()
 boolean isPut ()
 boolean isSecure ()
 boolean isXmlHttpRequest ()
 void set (string $key, mixed $value)
 Zend_Controller_Request_Http setAlias (string $name, string $target)
 Zend_Controller_Request_Http setBasePath ([string|null $basePath = null])
 Zend_Controller_Request_Http setBaseUrl ([mixed $baseUrl = null])
 Zend_Controller_Request_Http setParam (mixed $key, mixed $value)
 Zend_Controller_Request_Http setParamSources ([ $paramSources = array()], array $paramSoures)
 Zend_Controller_Request_Http setPathInfo ([string|null $pathInfo = null])
 Zend_Controller_Request_Http setPost (string|array $spec, [null|mixed $value = null])
 Zend_Controller_Request_Http setQuery (string|array $spec, [null|mixed $value = null])
 Zend_Controller_Request_Http setRequestUri ([string $requestUri = null])
 mixed __get (string $key)
 boolean __isset (string $key)
 void __set (string $key, mixed $value)
Variables
array $_aliases = array() (line 97)

Alias keys for request parameters

  • access: protected
string $_basePath = null (line 73)

Base path of request

  • access: protected
string $_baseUrl = null (line 67)

Base URL of request

  • access: protected
array $_params = array() (line 85)

Instance parameters

  • access: protected

Redefinition of:
Zend_Controller_Request_Abstract::$_params
Request parameters
array $_paramSources = array('_GET', '_POST') (line 55)

Allowed parameter sources

  • access: protected
string $_pathInfo = '' (line 79)

PATH_INFO

  • access: protected
string|false $_rawBody (line 91)

Raw request body

  • access: protected

Redefined in descendants as:
string; $_requestUri (line 61)

REQUEST_URI

  • access: protected

Inherited Variables

Inherited from Zend_Controller_Request_Abstract

Zend_Controller_Request_Abstract::$_action
Zend_Controller_Request_Abstract::$_actionKey
Zend_Controller_Request_Abstract::$_controller
Zend_Controller_Request_Abstract::$_controllerKey
Zend_Controller_Request_Abstract::$_dispatched
Zend_Controller_Request_Abstract::$_module
Zend_Controller_Request_Abstract::$_moduleKey
Methods
Constructor __construct (line 109)

Constructor

If a $uri is passed, the object will attempt to populate itself using that information.

  • throws: Zend_Controller_Request_Exception when invalid URI passed
  • access: public
void __construct ([string|Zend_Uri $uri = null])
get (line 170)

Alias to __get

  • access: public
mixed get (string $key)
  • string $key
getAlias (line 799)

Retrieve an alias

Retrieve the actual key represented by the alias $name.

  • return: Returns null when no alias exists
  • access: public
string|null getAlias (string $name)
  • string $name
getAliases (line 813)

Retrieve the list of all aliases

  • access: public
array getAliases ()
getBasePath (line 597)

Everything in REQUEST_URI before PATH_INFO not including the filename <img src="<?=$basePath?>/images/zend.png"/>

  • access: public
string getBasePath ()
getBaseUrl (line 548)

Everything in REQUEST_URI before PATH_INFO <form action="<?=$baseUrl?>/news/submit" method="POST"/>

  • access: public
string getBaseUrl ()
getClientIp (line 1041)

Get the client's IP addres

  • access: public
string getClientIp ([boolean $checkProxy = true])
  • boolean $checkProxy
getCookie (line 336)

Retrieve a member of the $_COOKIE superglobal

If no $key is passed, returns the entire $_COOKIE array.

  • return: Returns null if key does not exist
  • todo: How to retrieve from nested arrays
  • access: public
mixed getCookie ([string $key = null], [mixed $default = null])
  • string $key
  • mixed $default: Default value to use if key not found
getEnv (line 372)

Retrieve a member of the $_ENV superglobal

If no $key is passed, returns the entire $_ENV array.

  • return: Returns null if key does not exist
  • access: public
mixed getEnv ([string $key = null], [mixed $default = null])
  • string $key
  • mixed $default: Default value to use if key not found
getHeader (line 973)

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.

  • return: HTTP header value, or false if not found
  • throws: Zend_Controller_Request_Exception
  • access: public
string|false getHeader (string $header)
  • string $header: HTTP header name

Redefined in descendants as:
getHttpHost (line 1017)

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.

  • access: public
string getHttpHost ()
getMethod (line 823)

Return the method by which the request was made

  • access: public
string getMethod ()

Redefined in descendants as:
getParam (line 714)

Retrieve a parameter

Retrieves a parameter from the instance. Priority is in the order of userland parameters (see 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.

  • access: public
mixed getParam (mixed $key, [mixed $default = null])
  • mixed $key
  • mixed $default: Default value to use if key not found

Redefinition of:
Zend_Controller_Request_Abstract::getParam()
Get an action parameter
getParams (line 739)

Retrieve an array of parameters

Retrieves a merged array of parameters, with precedence of userland params (see setParam()), $_GET, $_POST (i.e., values in the userland params will take precedence over all others).

  • access: public
array getParams ()

Redefinition of:
Zend_Controller_Request_Abstract::getParams()
Get all action parameters
getParamSources (line 679)

Get list of allowed parameter sources

  • access: public
array getParamSources ()
getPathInfo (line 651)

Returns everything between the BaseUrl and QueryString.

This value is calculated instead of reading PATH_INFO directly from $_SERVER due to cross-platform differences.

  • access: public
string getPathInfo ()
getPost (line 317)

Retrieve a member of the $_POST superglobal

If no $key is passed, returns the entire $_POST array.

  • return: Returns null if key does not exist
  • todo: How to retrieve from nested arrays
  • access: public
mixed getPost ([string $key = null], [mixed $default = null])
  • string $key
  • mixed $default: Default value to use if key not found
getQuery (line 275)

Retrieve a member of the $_GET superglobal

If no $key is passed, returns the entire $_GET array.

  • return: Returns null if key does not exist
  • todo: How to retrieve from nested arrays
  • access: public
mixed getQuery ([string $key = null], [mixed $default = null])
  • string $key
  • mixed $default: Default value to use if key not found
getRawBody (line 950)

Return the raw body of the request, if present

  • return: Raw body, or false if not present
  • access: public
string|false getRawBody ()

Redefined in descendants as:
getRequestUri (line 440)

Returns the REQUEST_URI taking into account platform differences between Apache and IIS

  • access: public
string getRequestUri ()

Redefined in descendants as:
getScheme (line 1003)

Get the request URI scheme

  • access: public
string getScheme ()
getServer (line 354)

Retrieve a member of the $_SERVER superglobal

If no $key is passed, returns the entire $_SERVER array.

  • return: Returns null if key does not exist
  • access: public
mixed getServer ([string $key = null], [mixed $default = null])
  • string $key
  • mixed $default: Default value to use if key not found
has (line 237)

Alias to __isset()

  • access: public
boolean has (string $key)
  • string $key
isDelete (line 875)

Was the request made by DELETE?

  • access: public
boolean isDelete ()
isFlashRequest (line 929)

Is this a Flash request?

  • access: public
boolean isFlashRequest ()
isGet (line 847)

Was the request made by GET?

  • access: public
boolean isGet ()
isHead (line 889)

Was the request made by HEAD?

  • access: public
boolean isHead ()
isOptions (line 903)

Was the request made by OPTIONS?

  • access: public
boolean isOptions ()
isPost (line 833)

Was the request made by POST?

  • access: public
boolean isPost ()
isPut (line 861)

Was the request made by PUT?

  • access: public
boolean isPut ()
isSecure (line 940)

Is https secure request

  • access: public
boolean isSecure ()
isXmlHttpRequest (line 919)

Is the request a Javascript XMLHttpRequest?

Should work with Prototype/Script.aculo.us, possibly others.

  • access: public
boolean isXmlHttpRequest ()
set (line 200)

Alias to __set()

  • access: public
void set (string $key, mixed $value)
  • string $key
  • mixed $value
setAlias (line 785)

Set a key alias

Set an alias used for key lookups. $name specifies the alias, $target specifies the actual key to use.

  • access: public
Zend_Controller_Request_Http setAlias (string $name, string $target)
  • string $name
  • string $target
setBasePath (line 563)

Set the base path for the URL

  • access: public
Zend_Controller_Request_Http setBasePath ([string|null $basePath = null])
  • string|null $basePath
setBaseUrl (line 469)

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.

  • access: public
Zend_Controller_Request_Http setBaseUrl ([mixed $baseUrl = null])
  • mixed $baseUrl
setParam (line 694)

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.

  • access: public
Zend_Controller_Request_Http setParam (mixed $key, mixed $value)
  • mixed $key
  • mixed $value

Redefinition of:
Zend_Controller_Request_Abstract::setParam()
Set an action parameter
setParams (line 767)

Set parameters

Set one or more parameters. Parameters are set as userland parameters, using the keys specified in the array.

  • access: public
Zend_Controller_Request_Http setParams ( $params)
  • array $params

Redefinition of:
Zend_Controller_Request_Abstract::setParams()
Set action parameters en masse; does not overwrite
setParamSources (line 668)

Set allowed parameter sources

Can be empty array, or contain one or more of '_GET' or '_POST'.

  • access: public
Zend_Controller_Request_Http setParamSources ([ $paramSources = array()], array $paramSoures)
  • array $paramSoures
  • array $paramSources
setPathInfo (line 612)

Set the PATH_INFO string

  • access: public
Zend_Controller_Request_Http setPathInfo ([string|null $pathInfo = null])
  • string|null $pathInfo
setPost (line 291)

Set POST values

  • access: public
Zend_Controller_Request_Http setPost (string|array $spec, [null|mixed $value = null])
  • string|array $spec
  • null|mixed $value
setQuery (line 249)

Set GET values

  • access: public
Zend_Controller_Request_Http setQuery (string|array $spec, [null|mixed $value = null])
  • string|array $spec
  • null|mixed $value
setRequestUri (line 390)

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'].

  • access: public
Zend_Controller_Request_Http setRequestUri ([string $requestUri = null])
  • string $requestUri

Redefined in descendants as:
__get (line 140)

Access values contained in the superglobals as public members Order of precedence: 1. GET, 2. POST, 3. COOKIE, 4. SERVER, 5. ENV

mixed __get (string $key)
  • string $key
__isset (line 211)

Check to see if a property is set

  • access: public
boolean __isset (string $key)
  • string $key
__set (line 187)

Set values

In order to follow __get(), which operates on a number of superglobals, setting values through overloading is not allowed and will raise an exception. Use setParam() instead.

  • throws: Zend_Controller_Request_Exception
  • access: public
void __set (string $key, mixed $value)
  • string $key
  • mixed $value

Inherited Methods

Inherited From Zend_Controller_Request_Abstract

 Zend_Controller_Request_Abstract::clearParams()
 Zend_Controller_Request_Abstract::getActionKey()
 Zend_Controller_Request_Abstract::getActionName()
 Zend_Controller_Request_Abstract::getControllerKey()
 Zend_Controller_Request_Abstract::getControllerName()
 Zend_Controller_Request_Abstract::getModuleKey()
 Zend_Controller_Request_Abstract::getModuleName()
 Zend_Controller_Request_Abstract::getParam()
 Zend_Controller_Request_Abstract::getParams()
 Zend_Controller_Request_Abstract::getUserParam()
 Zend_Controller_Request_Abstract::getUserParams()
 Zend_Controller_Request_Abstract::isDispatched()
 Zend_Controller_Request_Abstract::setActionKey()
 Zend_Controller_Request_Abstract::setActionName()
 Zend_Controller_Request_Abstract::setControllerKey()
 Zend_Controller_Request_Abstract::setControllerName()
 Zend_Controller_Request_Abstract::setDispatched()
 Zend_Controller_Request_Abstract::setModuleKey()
 Zend_Controller_Request_Abstract::setModuleName()
 Zend_Controller_Request_Abstract::setParam()
 Zend_Controller_Request_Abstract::setParams()
Class Constants
SCHEME_HTTP = 'http' (line 43)

Scheme for http

SCHEME_HTTPS = 'https' (line 49)

Scheme for https

Documentation generated on Mon, 21 Jun 2010 15:27:25 -0400 by phpDocumentor 1.4.3