Microsoft_Http
[ class tree: Microsoft_Http ] [ index: Microsoft_Http ] [ all elements ]

Class: Microsoft_Http_Response_Stream

Source Location: /Http/Response/Stream.php

Class Overview

Microsoft_Http_Response
   |
   --Microsoft_Http_Response_Stream

Microsoft_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.


Author(s):

Copyright:

  • Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)

Variables

Methods


Inherited Variables

Inherited Methods

Class: Microsoft_Http_Response

Microsoft_Http_Response::__construct()
HTTP response constructor
Microsoft_Http_Response::asString()
Get the entire response as string
Microsoft_Http_Response::decodeChunkedBody()
Decode a "chunked" transfer-encoded body and return the decoded text
Microsoft_Http_Response::decodeDeflate()
Decode a zlib deflated message (when Content-encoding = deflate)
Microsoft_Http_Response::decodeGzip()
Decode a gzip encoded message (when Content-encoding = gzip)
Microsoft_Http_Response::extractBody()
Extract the body from a response string
Microsoft_Http_Response::extractCode()
Extract the response code from a response string
Microsoft_Http_Response::extractHeaders()
Extract the headers from a response string
Microsoft_Http_Response::extractMessage()
Extract the HTTP message from a response
Microsoft_Http_Response::extractVersion()
Extract the HTTP version from a response
Microsoft_Http_Response::fromString()
Create a new Microsoft_Http_Response object from a string
Microsoft_Http_Response::getBody()
Get the response body as string
Microsoft_Http_Response::getHeader()
Get a specific header as string, or null if it is not set
Microsoft_Http_Response::getHeaders()
Get the response headers
Microsoft_Http_Response::getHeadersAsString()
Get all headers as string
Microsoft_Http_Response::getMessage()
Return a message describing the HTTP response code (Eg. "OK", "Not Found", "Moved Permanently")
Microsoft_Http_Response::getRawBody()
Get the raw response body (as transfered "on wire") as string
Microsoft_Http_Response::getStatus()
Get the HTTP response status code
Microsoft_Http_Response::getVersion()
Get the HTTP version of the response
Microsoft_Http_Response::isError()
Check whether the response is an error
Microsoft_Http_Response::isRedirect()
Check whether the response is a redirection
Microsoft_Http_Response::isSuccessful()
Check whether the response in successful
Microsoft_Http_Response::responseCodeAsText()
A convenience function that returns a text representation of HTTP response codes. Returns 'Unknown' for unknown codes.
Microsoft_Http_Response::__toString()
Implements magic __toString()

Class Details

[line 39]
Microsoft_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.



Tags:

copyright:  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
license:  New BSD License


[ Top ]


Class Variables

$stream =

[line 46]

Response as stream



Tags:

access:  protected

Type:   resource


[ Top ]

$stream_name =

[line 55]

The name of the file containing the stream

Will be empty if stream is not file-based.




Tags:

access:  protected

Type:   string


[ Top ]

$_cleanup =

[line 62]

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



Tags:

access:  protected

Type:   boolean


[ Top ]



Class Methods


static method fromStream [line 161]

static Microsoft_Http_Response_Stream fromStream( string $response_str, resource $stream)

Create a new Microsoft_Http_Response_Stream object from a string



Tags:

access:  public


Parameters:

string   $response_str  
resource   $stream  

[ Top ]

constructor __construct [line 144]

Microsoft_Http_Response_Stream __construct( int $code, array $headers, [string $body = null], [string $version = '1.1'], [string $message = null])

HTTP response constructor

In most cases, you would use Microsoft_Http_Response::fromString to parse an HTTP response string and create a new Microsoft_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.




Tags:

throws:  Microsoft_Http_Exception
access:  public


Overrides Microsoft_Http_Response::__construct() (HTTP response constructor)

Parameters:

int   $code   Response code (200, 404, ...)
array   $headers   Headers array
string   $body   Response body
string   $version   HTTP version
string   $message   Response code as text

[ Top ]

destructor __destruct [line 229]

void __destruct( )



Tags:

access:  public


[ Top ]

method getBody [line 183]

string 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.




Tags:

access:  public


Overrides Microsoft_Http_Response::getBody() (Get the response body as string)

[ Top ]

method getCleanup [line 91]

boolean getCleanup( )

Get the cleanup trigger



Tags:

access:  public


[ Top ]

method getRawBody [line 199]

string 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.




Tags:

access:  public


Overrides Microsoft_Http_Response::getRawBody() (Get the raw response body (as transfered "on wire") as string)

[ Top ]

method getStream [line 69]

resourse getStream( )

Get the response as stream



Tags:

access:  public


[ Top ]

method getStreamName [line 109]

string getStreamName( )

Get file name associated with the stream



Tags:

access:  public


[ Top ]

method readStream [line 214]

string readStream( )

Read stream content and return it as string

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




Tags:

access:  protected


[ Top ]

method setCleanup [line 100]

void setCleanup( [$cleanup $cleanup = true])

Set the cleanup trigger



Tags:

access:  public


Parameters:

$cleanup   $cleanup   Set cleanup trigger

[ Top ]

method setStream [line 80]

Microsoft_Http_Response_Stream setStream( resourse $stream)

Set the response stream



Tags:

access:  public


Parameters:

resourse   $stream  

[ Top ]

method setStreamName [line 119]

Microsoft_Http_Response_Stream setStreamName( string $stream_name)

Set file name associated with the stream



Tags:

access:  public


Parameters:

string   $stream_name   Name to set

[ Top ]


Documentation generated on Wed, 18 May 2011 12:06:54 +0200 by phpDocumentor 1.4.3