HTTP Request

link http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5
package Default
inherited_from \Zend\Http\AbstractMessage

 Methods

Allow PHP casting of this object

__toString() : string
Inherited

Returns

string

A factory that produces a Request object from a well-formed Http Request string

fromString(string $string, boolean $allowCustomMethods = true) : \Zend\Http\Request
Static

Parameters

$string

string

$allowCustomMethods

boolean

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\Request

getAllowCustomMethods()

getAllowCustomMethods() : boolean

Returns

boolean

Get message content

getContent() : mixed
Inherited
inherited_from \Zend\Stdlib\MessageInterface::getContent()

Returns

mixed

Return the Cookie header, this is the same as calling $request->getHeaders()->get('Cookie');

getCookie() : \Zend\Http\Header\Cookie | boolean
convenience $request->getHeaders()->get('Cookie');

Returns

\Zend\Http\Header\Cookieboolean

Return the parameter container responsible for file parameters or a single file.

getFiles(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed

Parameters

$name

stringnull

Parameter name to retrieve, or null to get the whole container.

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

Get all headers of a certain name/type.

getHeader(string|null $name, mixed|null $default = false) : \Zend\Http\Headers | boolean | \Zend\Http\Header\HeaderInterface | \ArrayIterator
see

Parameters

$name

stringnull

Header name to retrieve, or null to get the whole container.

$default

mixednull

Default value to use when the requested header is missing.

Returns

\Zend\Http\Headersboolean\Zend\Http\Header\HeaderInterface\ArrayIterator

Return the header container responsible for headers or all headers of a certain name/type

getHeaders(string|null $name = null, mixed|null $default = false) : \Zend\Http\Headers | boolean | \Zend\Http\Header\HeaderInterface | \ArrayIterator
see
inherited_from \Zend\Http\AbstractMessage::getHeaders()

Parameters

$name

stringnull

Header name to retrieve, or null to get the whole container.

$default

mixednull

Default value to use when the requested header is missing.

Returns

\Zend\Http\Headersboolean\Zend\Http\Header\HeaderInterface\ArrayIterator

Return the header container responsible for headers

getHeaders() : \Zend\Http\Headers
Inherited

Returns

\Zend\Http\Headers

Return the method for this request

getMethod() : string

Returns

string

Return the parameter container responsible for post parameters or a single post parameter.

getPost(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed

Parameters

$name

stringnull

Parameter name to retrieve, or null to get the whole container.

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

Return the parameter container responsible for query parameters or a single query parameter

getQuery(string|null $name = null, mixed|null $default = null) : \Zend\Stdlib\ParametersInterface | mixed

Parameters

$name

stringnull

Parameter name to retrieve, or null to get the whole container.

$default

mixednull

Default value to use when the parameter is missing.

Returns

\Zend\Stdlib\ParametersInterfacemixed

Return the URI for this request object

getUri() : \Zend\Uri\Http

Returns

\Zend\Uri\Http

Return the URI for this request object as a string

getUriString() : string

Returns

string

Return the HTTP version for this request

getVersion() : string
Inherited

Returns

string

Is this a CONNECT method request?

isConnect() : boolean

Returns

boolean

Is this a DELETE method request?

isDelete() : boolean

Returns

boolean

Is this a Flash request?

isFlashRequest() : boolean

Returns

boolean

Is this a GET method request?

isGet() : boolean

Returns

boolean

Is this a HEAD method request?

isHead() : boolean

Returns

boolean

Is this an OPTIONS method request?

isOptions() : boolean

Returns

boolean

Is this a PATCH method request?

isPatch() : boolean

Returns

boolean

Is this a POST method request?

isPost() : boolean

Returns

boolean

Is this a PROPFIND method request?

isPropFind() : boolean

Returns

boolean

Is this a PUT method request?

isPut() : boolean

Returns

boolean

Is this a TRACE method request?

isTrace() : boolean

Returns

boolean

Is the request a Javascript XMLHttpRequest?

isXmlHttpRequest() : boolean

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

Returns

boolean

Return the formatted request line (first line) for this http request

renderRequestLine() : string

Returns

string

setAllowCustomMethods()

setAllowCustomMethods(boolean $strictMethods) 

Parameters

$strictMethods

boolean

Set message content

setContent(mixed $value) : \Zend\Stdlib\Message
Inherited
inherited_from \Zend\Stdlib\MessageInterface::setContent()

Parameters

$value

mixed

Returns

\Zend\Stdlib\Message

Provide an alternate Parameter Container implementation for file parameters in this object, (this is NOT the primary API for value setting, for that see getFiles())

setFiles(\Zend\Stdlib\ParametersInterface $files) : \Zend\Http\Request

Parameters

$files

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\Request

Provide an alternate Parameter Container implementation for headers in this object, (this is NOT the primary API for value setting, for that see getHeaders())

setHeaders(\Zend\Http\Headers $headers) : \Zend\Http\AbstractMessage
Inherited
see

Parameters

$headers

\Zend\Http\Headers

Returns

\Zend\Http\AbstractMessage

Set the method for this request

setMethod(string $method) : \Zend\Http\Request

Parameters

$method

string

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\Request

Provide an alternate Parameter Container implementation for post parameters in this object, (this is NOT the primary API for value setting, for that see getPost())

setPost(\Zend\Stdlib\ParametersInterface $post) : \Zend\Http\Request

Parameters

$post

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\Request

Provide an alternate Parameter Container implementation for query parameters in this object, (this is NOT the primary API for value setting, for that see getQuery())

setQuery(\Zend\Stdlib\ParametersInterface $query) : \Zend\Http\Request

Parameters

$query

\Zend\Stdlib\ParametersInterface

Returns

\Zend\Http\Request

Set the URI/URL for this request, this can be a string or an instance of Zend\Uri\Http

setUri(string|\Zend\Uri\Http $uri) : \Zend\Http\Request

Parameters

$uri

string\Zend\Uri\Http

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\Request

Set the HTTP version for this object, one of 1.0 or 1.1 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11)

setVersion(string $version) : \Zend\Http\AbstractMessage
Inherited

Parameters

$version

string

(Must be 1.0 or 1.1)

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\AbstractMessage

toString()

toString() : string

Returns

string

toString()

toString() : string
Inherited

Returns

string

 Properties

 

$allowCustomMethods

$allowCustomMethods : boolean

Default

true
 

$content

$content : string

Default

''
 

$fileParams

$fileParams : \Zend\Stdlib\ParametersInterface

Default

null
 

$headers

$headers : \Zend\Http\Headers | null

Default

null
   

$method

$method : string

Default

self::METHOD_GET
 

$postParams

$postParams : \Zend\Stdlib\ParametersInterface

Default

null
 

$queryParams

$queryParams : \Zend\Stdlib\ParametersInterface

Default

null
 

$uri

$uri : string | \Zend\Uri\Http

Default

null
 

$version

$version : string

Default

self::VERSION_11

 Constants

 

METHOD_CONNECT

METHOD_CONNECT = 'CONNECT' 
 

METHOD_DELETE

METHOD_DELETE = 'DELETE' 
 

METHOD_GET

METHOD_GET = 'GET' 
 

METHOD_HEAD

METHOD_HEAD = 'HEAD' 
 

METHOD_OPTIONS

METHOD_OPTIONS = 'OPTIONS' 
 

METHOD_PATCH

METHOD_PATCH = 'PATCH' 
 

METHOD_POST

METHOD_POST = 'POST' 
 

METHOD_PROPFIND

METHOD_PROPFIND = 'PROPFIND' 
 

METHOD_PUT

METHOD_PUT = 'PUT' 
 

METHOD_TRACE

METHOD_TRACE = 'TRACE' 
 

VERSION_10

VERSION_10 = '1.0' 
 

VERSION_11

VERSION_11 = '1.1'