Class Zend_Http_Response_Stream

Description

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-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Http/Response/Stream.php (line 34)

Zend_Http_Response
   |
   --Zend_Http_Response_Stream
Variable Summary
 resource $stream
 string $stream_name
 boolean $_cleanup
Method Summary
 static Zend_Http_Response_Stream fromStream (string $response_str, resource $stream)
 Zend_Http_Response_Stream __construct (int $code, array $headers, [string $body = null], [string $version = '1.1'], [string $message = null])
 void __destruct ()
 string getBody ()
 boolean getCleanup ()
 string getRawBody ()
 resourse getStream ()
 string getStreamName ()
 string readStream ()
 void setCleanup ([$cleanup $cleanup = true])
 Zend_Http_Response_Stream setStream (resourse $stream)
 Zend_Http_Response_Stream setStreamName (string $stream_name)
Variables
resource $stream (line 41)

Response as stream

  • access: protected
string $stream_name (line 50)

The name of the file containing the stream

Will be empty if stream is not file-based.

  • access: protected
boolean $_cleanup (line 57)

Should we clean up the stream file when this response is closed?

  • access: protected

Inherited Variables

Inherited from Zend_Http_Response

Zend_Http_Response::$body
Zend_Http_Response::$code
Zend_Http_Response::$headers
Zend_Http_Response::$message
Zend_Http_Response::$messages
Zend_Http_Response::$version
Methods
static fromStream (line 156)

Create a new Zend_Http_Response_Stream object from a string

  • access: public
static Zend_Http_Response_Stream fromStream (string $response_str, resource $stream)
  • string $response_str
  • resource $stream
Constructor __construct (line 139)

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.

  • throws: Zend_Http_Exception
  • access: public
Zend_Http_Response_Stream __construct (int $code, array $headers, [string $body = null], [string $version = '1.1'], [string $message = null])
  • int $code: Response code (200, 404, ...)
  • array $headers: Headers array
  • string $body: Response body
  • string $version: HTTP version
  • string $message: Response code as text

Redefinition of:
Zend_Http_Response::__construct()
HTTP response constructor
Destructor __destruct (line 224)
  • access: public
void __destruct ()
getBody (line 178)

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.

  • access: public
string getBody ()

Redefinition of:
Zend_Http_Response::getBody()
Get the response body as string
getCleanup (line 86)

Get the cleanup trigger

  • access: public
boolean getCleanup ()
getRawBody (line 194)

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.

  • access: public
string getRawBody ()

Redefinition of:
Zend_Http_Response::getRawBody()
Get the raw response body (as transfered "on wire") as string
getStream (line 64)

Get the response as stream

  • access: public
resourse getStream ()
getStreamName (line 104)

Get file name associated with the stream

  • access: public
string getStreamName ()
readStream (line 209)

Read stream content and return it as string

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

  • access: protected
string readStream ()
setCleanup (line 95)

Set the cleanup trigger

  • access: public
void setCleanup ([$cleanup $cleanup = true])
  • $cleanup $cleanup: Set cleanup trigger
setStream (line 75)

Set the response stream

  • access: public
Zend_Http_Response_Stream setStream (resourse $stream)
  • resourse $stream
setStreamName (line 114)

Set file name associated with the stream

  • access: public
Zend_Http_Response_Stream setStreamName (string $stream_name)
  • string $stream_name: Name to set

Inherited Methods

Inherited From Zend_Http_Response

 Zend_Http_Response::__construct()
 Zend_Http_Response::asString()
 Zend_Http_Response::decodeChunkedBody()
 Zend_Http_Response::decodeDeflate()
 Zend_Http_Response::decodeGzip()
 Zend_Http_Response::extractBody()
 Zend_Http_Response::extractCode()
 Zend_Http_Response::extractHeaders()
 Zend_Http_Response::extractMessage()
 Zend_Http_Response::extractVersion()
 Zend_Http_Response::fromString()
 Zend_Http_Response::getBody()
 Zend_Http_Response::getHeader()
 Zend_Http_Response::getHeaders()
 Zend_Http_Response::getHeadersAsString()
 Zend_Http_Response::getMessage()
 Zend_Http_Response::getRawBody()
 Zend_Http_Response::getStatus()
 Zend_Http_Response::getVersion()
 Zend_Http_Response::isError()
 Zend_Http_Response::isRedirect()
 Zend_Http_Response::isSuccessful()
 Zend_Http_Response::responseCodeAsText()
 Zend_Http_Response::__toString()

Documentation generated on Mon, 21 Jun 2010 15:46:55 -0400 by phpDocumentor 1.4.3