Moodle  2.2.1
http://www.collinsharper.com
Zend_Http_Response Class Reference
Inheritance diagram for Zend_Http_Response:

Public Member Functions

 __construct ($code, $headers, $body=null, $version= '1.1', $message=null)
 isError ()
 isSuccessful ()
 isRedirect ()
 getBody ()
 getRawBody ()
 getVersion ()
 getStatus ()
 getMessage ()
 getHeaders ()
 getHeader ($header)
 getHeadersAsString ($status_line=true, $br="\n")
 asString ($br="\n")
 __toString ()

Static Public Member Functions

static responseCodeAsText ($code=null, $http11=true)
static extractCode ($response_str)
static extractMessage ($response_str)
static extractVersion ($response_str)
static extractHeaders ($response_str)
static extractBody ($response_str)
static decodeChunkedBody ($body)
static decodeGzip ($body)
static decodeDeflate ($body)
static fromString ($response_str)

Protected Attributes

 $version
 $code
 $message
 $headers = array()
 $body

Static Protected Attributes

static $messages

Detailed Description

Definition at line 34 of file Response.php.


Constructor & Destructor Documentation

__construct ( code,
headers,
body = null,
version = '1.1',
message = null 
)

HTTP response constructor

In most cases, you would use Zend_Http_Response::fromString to parse an HTTP response string and create a new Zend_Http_Response object.

NOTE: The constructor no longer accepts nulls or empty values for the code and headers and will throw an exception if the passed values do not form a valid HTTP responses.

If no message is passed, the message will be guessed according to the response code.

Parameters:
int$codeResponse code (200, 404, ...)
array$headersHeaders array
string$bodyResponse body
string$versionHTTP version
string$messageResponse code as text
Exceptions:
Zend_Http_Exception

Reimplemented in Zend_Http_Response_Stream.

Definition at line 151 of file Response.php.

Here is the call graph for this function:


Member Function Documentation

Implements magic __toString()

Returns:
string

Definition at line 405 of file Response.php.

Here is the call graph for this function:

asString ( br = "\n")

Get the entire response as string

Parameters:
string$brLine breaks (eg. "\n", "\r\n", "<br />")
Returns:
string

Definition at line 395 of file Response.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static decodeChunkedBody ( body) [static]

Decode a "chunked" transfer-encoded body and return the decoded text

Parameters:
string$body
Returns:
string

Definition at line 560 of file Response.php.

Here is the caller graph for this function:

static decodeDeflate ( body) [static]

Decode a zlib deflated message (when Content-encoding = deflate)

Currently requires PHP with zlib support

Parameters:
string$body
Returns:
string

Some servers (IIS ?) send a broken deflate response, without the RFC-required zlib header.

We try to detect the zlib header, and if it does not exsit we teat the body is plain DEFLATE content.

This method was adapted from PEAR HTTP_Request2 by (c) Alexey Borzov

http://framework.zend.com/issues/browse/ZF-6040

Definition at line 620 of file Response.php.

Here is the caller graph for this function:

static decodeGzip ( body) [static]

Decode a gzip encoded message (when Content-encoding = gzip)

Currently requires PHP with zlib support

Parameters:
string$body
Returns:
string

Definition at line 600 of file Response.php.

Here is the caller graph for this function:

static extractBody ( response_str) [static]

Extract the body from a response string

Parameters:
string$response_str
Returns:
string

Definition at line 545 of file Response.php.

Here is the caller graph for this function:

static extractCode ( response_str) [static]

Extract the response code from a response string

Parameters:
string$response_str
Returns:
int

Definition at line 442 of file Response.php.

Here is the caller graph for this function:

static extractHeaders ( response_str) [static]

Extract the headers from a response string

Parameters:
string$response_str
Returns:
array

Definition at line 493 of file Response.php.

Here is the caller graph for this function:

static extractMessage ( response_str) [static]

Extract the HTTP message from a response

Parameters:
string$response_str
Returns:
string

Definition at line 459 of file Response.php.

Here is the caller graph for this function:

static extractVersion ( response_str) [static]

Extract the HTTP version from a response

Parameters:
string$response_str
Returns:
string

Definition at line 476 of file Response.php.

Here is the caller graph for this function:

static fromString ( response_str) [static]

Create a new Zend_Http_Response object from a string

Parameters:
string$response_str
Returns:
Zend_Http_Response

Definition at line 654 of file Response.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getBody ( )

Get the response body as string

This method returns the body of the HTTP response (the content), as it should be in it's readable version - that is, after decoding it (if it was decoded), deflating it (if it was gzip compressed), etc.

If you want to get the raw body (as transfered on wire) use $this->getRawBody() instead.

Returns:
string

Reimplemented in Zend_Http_Response_Stream.

Definition at line 251 of file Response.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getHeader ( header)

Get a specific header as string, or null if it is not set

Parameters:
string$header
Returns:
string|array|null

Definition at line 350 of file Response.php.

Here is the caller graph for this function:

Get the response headers

Returns:
array

Definition at line 339 of file Response.php.

getHeadersAsString ( status_line = true,
br = "\n" 
)

Get all headers as string

Parameters:
boolean$status_lineWhether to return the first status line (IE "HTTP 200 OK")
string$brLine breaks (eg. "\n", "\r\n", "<br />")
Returns:
string

Definition at line 365 of file Response.php.

Here is the caller graph for this function:

Return a message describing the HTTP response code (Eg. "OK", "Not Found", "Moved Permanently")

Returns:
string

Definition at line 329 of file Response.php.

Here is the caller graph for this function:

Get the raw response body (as transfered "on wire") as string

If the body is encoded (with Transfer-Encoding, not content-encoding - IE "chunked" body), gzip compressed, etc. it will not be decoded.

Returns:
string

Reimplemented in Zend_Http_Response_Stream.

Definition at line 298 of file Response.php.

Here is the caller graph for this function:

getStatus ( )

Get the HTTP response status code

Returns:
int

Definition at line 318 of file Response.php.

Here is the caller graph for this function:

Get the HTTP version of the response

Returns:
string

Definition at line 308 of file Response.php.

Here is the caller graph for this function:

isError ( )

Check whether the response is an error

Returns:
boolean

Definition at line 199 of file Response.php.

Here is the caller graph for this function:

Check whether the response is a redirection

Returns:
boolean

Definition at line 229 of file Response.php.

Check whether the response in successful

Returns:
boolean

Definition at line 214 of file Response.php.

static responseCodeAsText ( code = null,
http11 = true 
) [static]

A convenience function that returns a text representation of HTTP response codes. Returns 'Unknown' for unknown codes. Returns array of all codes, if $code is not specified.

Conforms to HTTP/1.1 as defined in RFC 2616 (except for 'Unknown') See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 for reference

Parameters:
int$codeHTTP response code
boolean$http11Use HTTP version 1.1
Returns:
string

Definition at line 422 of file Response.php.

Here is the caller graph for this function:


Field Documentation

$body [protected]

Definition at line 130 of file Response.php.

$code [protected]

Definition at line 108 of file Response.php.

$headers = array() [protected]

Definition at line 123 of file Response.php.

$message [protected]

Definition at line 116 of file Response.php.

$messages [static, protected]

Definition at line 42 of file Response.php.

$version [protected]

Definition at line 101 of file Response.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations