Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_Http_Response_Stream Class Reference

Public Member Functions

 getStream ()
 Get the response as stream.
 
 setStream ($stream)
 Set the response stream.
 
 getCleanup ()
 Get the cleanup trigger.
 
 setCleanup ($cleanup=true)
 Set the cleanup trigger.
 
 getStreamName ()
 Get file name associated with the stream.
 
 setStreamName ($stream_name)
 Set file name associated with the stream.
 
 __construct ($code, $headers, $body=null, $version= '1.1', $message=null)
 HTTP response constructor.
 
 getBody ()
 Get the response body as string.
 
 getRawBody ()
 Get the raw response body (as transfered "on wire") as string.
 
 __destruct ()
 
- Public Member Functions inherited from Zend_Http_Response
 __construct ($code, array $headers, $body=null, $version= '1.1', $message=null)
 HTTP response constructor.
 
 isError ()
 Check whether the response is an error.
 
 isSuccessful ()
 Check whether the response in successful.
 
 isRedirect ()
 Check whether the response is a redirection.
 
 getBody ()
 Get the response body as string.
 
 getRawBody ()
 Get the raw response body (as transfered "on wire") as string.
 
 getVersion ()
 Get the HTTP version of the response.
 
 getStatus ()
 Get the HTTP response status code.
 
 getMessage ()
 Return a message describing the HTTP response code (Eg.
 
 getHeaders ()
 Get the response headers.
 
 getHeader ($header)
 Get a specific header as string, or null if it is not set.
 
 getHeadersAsString ($status_line=true, $br="\n")
 Get all headers as string.
 
 asString ($br="\n")
 Get the entire response as string.
 
 __toString ()
 Implements magic __toString()
 

Static Public Member Functions

static fromStream ($response_str, $stream)
 Create a new Zend_Http_Response_Stream object from a string.
 
- Static Public Member Functions inherited from Zend_Http_Response
static responseCodeAsText ($code=null, $http11=true)
 A convenience function that returns a text representation of HTTP response codes.
 
static extractCode ($response_str)
 Extract the response code from a response string.
 
static extractMessage ($response_str)
 Extract the HTTP message from a response.
 
static extractVersion ($response_str)
 Extract the HTTP version from a response.
 
static extractHeaders ($response_str)
 Extract the headers from a response string.
 
static extractBody ($response_str)
 Extract the body from a response string.
 
static decodeChunkedBody ($body)
 Decode a "chunked" transfer-encoded body and return the decoded text.
 
static decodeGzip ($body)
 Decode a gzip encoded message (when Content-encoding = gzip)
 
static decodeDeflate ($body)
 Decode a zlib deflated message (when Content-encoding = deflate)
 
static fromString ($response_str)
 Create a new Zend_Http_Response object from a string.
 

Protected Member Functions

 readStream ()
 Read stream content and return it as string.
 

Protected Attributes

 $stream
 
 $stream_name
 
 $_cleanup
 
- Protected Attributes inherited from Zend_Http_Response
 $version
 
 $code
 
 $message
 
 $headers = array()
 
 $body
 

Additional Inherited Members

- Static Protected Attributes inherited from Zend_Http_Response
static $messages
 

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
__destruct ( )

Member Function Documentation

static fromStream (   $response_str,
  $stream 
)
static

Create a new Zend_Http_Response_Stream object from a string.

Parameters
string$response_str
resource$stream
Returns
Zend_Http_Response_Stream
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
getCleanup ( )

Get the cleanup trigger.

Returns
boolean
getRawBody ( )

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
getStream ( )

Get the response as stream.

Returns
resourse
getStreamName ( )

Get file name associated with the stream.

Returns
string
readStream ( )
protected

Read stream content and return it as string.

Function reads the remainder of the body from the stream and closes the stream.

Returns
string
setCleanup (   $cleanup = true)

Set the cleanup trigger.

Parameters
bool$cleanupSet cleanup trigger
setStream (   $stream)

Set the response stream.

Parameters
resourse$stream
Returns
Zend_Http_Response_Stream
setStreamName (   $stream_name)

Set file name associated with the stream.

Parameters
string$stream_nameName to set
Returns
Zend_Http_Response_Stream

Member Data Documentation

$_cleanup
protected
$stream
protected
$stream_name
protected