\Zend_Http_Response
Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It includes easy access to all the response's different elemts, as well as some convenience methods for parsing and validating HTTP responses.
- Copyright: Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- License: http://framework.zend.com/license/new-bsd New BSD License
Synopsis
class Zend_Http_Response
{
- // members
- protected static array $messages = ;
- protected $version;
- protected $code;
- protected $message;
- protected array $headers = ;
- protected $body;
- // methods
- public void __construct()
- public boolean isError()
- public boolean isSuccessful()
- public boolean isRedirect()
- public string getBody()
- public string getRawBody()
- public string getVersion()
- public int getStatus()
- public string getMessage()
- public array getHeaders()
- public string|array|null getHeader()
- public string getHeadersAsString()
- public string asString()
- public static string responseCodeAsText()
- public static int extractCode()
- public static string extractMessage()
- public static string extractVersion()
- public static array extractHeaders()
- public static string extractBody()
- public static string decodeChunkedBody()
- public static string decodeGzip()
- public static string decodeDeflate()
- public static Zend_Http_Response fromString()
Members
protected
- $body
—
string
The HTTP response body - $code
—
int
The HTTP response code - $headers
—
array
The HTTP response headers array - $message
—
string
The HTTP response code as string (e.g. 'Not Found' for 404 or 'Internal Server Error' for 500) - $messages
—
array
List of all known HTTP response codes - used by responseCodeAsText() to translate numeric codes to messages. - $version
—
string
The HTTP version (1.0, 1.1)
Methods
public
- __construct() — HTTP response constructor
- asString() — Get the entire response as string
- decodeChunkedBody() — Decode a "chunked" transfer-encoded body and return the decoded text
- decodeDeflate() — Decode a zlib deflated message (when Content-encoding = deflate)
- decodeGzip() — Decode a gzip encoded message (when Content-encoding = gzip)
- extractBody() — Extract the body from a response string
- extractCode() — Extract the response code from a response string
- extractHeaders() — Extract the headers from a response string
- extractMessage() — Extract the HTTP message from a response
- extractVersion() — Extract the HTTP version from a response
- fromString() — Create a new Zend_Http_Response object from a string
- getBody() — Get the response body as string
- getHeader() — Get a specific header as string, or null if it is not set
- getHeaders() — Get the response headers
- getHeadersAsString() — Get all headers as string
- getMessage() — Return a message describing the HTTP response code (Eg. "OK", "Not Found", "Moved Permanently")
- getRawBody() — Get the raw response body (as transfered "on wire") as string
- getStatus() — Get the HTTP response status code
- getVersion() — Get the HTTP version of the response
- isError() — Check whether the response is an error
- isRedirect() — Check whether the response is a redirection
- isSuccessful() — Check whether the response in successful
- responseCodeAsText() — A convenience function that returns a text representation of HTTP response codes. Returns 'Unknown' for unknown codes.