Class MOXMAN_Http_HttpClientResponse
Inheritance | MOXMAN_Http_HttpClientResponse |
---|
This class represents the HTTP response from a MOXMAN_Http_HttpClient instance.
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Constructs a new http client response instance this is normally done by the HTTP client. | MOXMAN_Http_HttpClientResponse |
__destruct() | Automatically close the socket on destruction. | MOXMAN_Http_HttpClientResponse |
getBody() | Returns the whole HTTP response content body as a string. | MOXMAN_Http_HttpClientResponse |
getCode() | Returns the HTTP status code like 200 for an valid request. | MOXMAN_Http_HttpClientResponse |
getHeader() | Returns a specific header by name if it's not found it will return the specified default value. | MOXMAN_Http_HttpClientResponse |
getHeaders() | Returns all http headers as an array. | MOXMAN_Http_HttpClientResponse |
getMessage() | Returns the HTTP status message like OK for an valid request. | MOXMAN_Http_HttpClientResponse |
getVersion() | Http version like 1.1. | MOXMAN_Http_HttpClientResponse |
read() | Reads a chunk out of the response body stream and returns the result data. | MOXMAN_Http_HttpClientResponse |
Method Details
Constructs a new http client response instance this is normally done by the HTTP client.
public void __construct ( $client, $req, $contentLength = 0 ) | ||
$client | MOXMAN_Http_HttpClient | HTTP client instance to connect to request. |
$req | MOXMAN_Http_HttpClientRequest | HTTP client request instance for the specified response. |
$contentLength |
Automatically close the socket on destruction.
public void __destruct ( ) |
Returns the whole HTTP response content body as a string.
public String getBody ( ) | ||
return | String | HTTP response content body. |
---|
Returns the HTTP status code like 200 for an valid request.
public Int getCode ( ) | ||
return | Int | HTTP status code like 200. |
---|
Returns a specific header by name if it's not found it will return the specified default value.
public mixed getHeader ( $name, $default = null ) | ||
$name | string | Name of the header to retrive. |
$default | mixed | Default value to return. |
return | mixed | Specified header value or default value if it doesn't exist. |
---|
Returns all http headers as an array.
public Array getHeaders ( ) | ||
return | Array | Name/value array with all HTTP headers. |
---|
Returns the HTTP status message like OK for an valid request.
public Int getMessage ( ) | ||
return | Int | HTTP status message like OK. |
---|
Http version like 1.1.
public String getVersion ( ) | ||
return | String | Http version string. |
---|
Reads a chunk out of the response body stream and returns the result data.
public String read ( ) | ||
return | String | Data from response stream or empty string if there is no more data to read. |
---|