XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
HTTP_Request2_Response Class Reference

Public Member Functions

 __construct ($statusLine, $bodyEncoded=true, $effectiveUrl=null)
 
 parseHeaderLine ($headerLine)
 
 appendBody ($bodyChunk)
 
 getEffectiveUrl ()
 
 getStatus ()
 
 getReasonPhrase ()
 
 isRedirect ()
 
 getHeader ($headerName=null)
 
 getCookies ()
 
 getBody ()
 
 getVersion ()
 

Static Public Member Functions

static getDefaultReasonPhrase ($code=null)
 
static decodeGzip ($data)
 
static decodeDeflate ($data)
 

Protected Member Functions

 parseCookie ($cookieString)
 

Protected Attributes

 $version
 
 $code
 
 $reasonPhrase
 
 $effectiveUrl
 
 $headers = array()
 
 $cookies = array()
 
 $lastHeader = null
 
 $body = ''
 
 $bodyEncoded
 

Static Protected Attributes

static $phrases
 

Detailed Description

Definition at line 54 of file Response.php.

Constructor & Destructor Documentation

HTTP_Request2_Response::__construct (   $statusLine,
  $bodyEncoded = true,
  $effectiveUrl = null 
)

Constructor, parses the response status line

Parameters
string$statusLineResponse status line (e.g. "HTTP/1.1 200 OK")
bool$bodyEncodedWhether body is still encoded by Content-Encoding
string$effectiveUrlEffective URL of the response
Exceptions
HTTP_Request2_MessageExceptionif status line is invalid according to spec

Definition at line 212 of file Response.php.

Member Function Documentation

HTTP_Request2_Response::appendBody (   $bodyChunk)

Appends a string to the response body

Parameters
string$bodyChunkpart of response body

Definition at line 339 of file Response.php.

static HTTP_Request2_Response::decodeDeflate (   $data)
static

Decodes the message-body encoded by deflate

Parameters
string$datadeflate-encoded data
Returns
string decoded data
Exceptions
HTTP_Request2_LogicException

Definition at line 615 of file Response.php.

static HTTP_Request2_Response::decodeGzip (   $data)
static

Decodes the message-body encoded by gzip

The real decoding work is done by gzinflate() built-in function, this method only parses the header and checks data for compliance with RFC 1952

Parameters
string$datagzip-encoded data
Returns
string decoded data
Exceptions
HTTP_Request2_LogicException
HTTP_Request2_MessageExceptionhttp://tools.ietf.org/html/rfc1952

Definition at line 481 of file Response.php.

HTTP_Request2_Response::getBody ( )

Returns the body of the response

Returns
string
Exceptions
HTTP_Request2_Exceptionif body cannot be decoded

Definition at line 423 of file Response.php.

HTTP_Request2_Response::getCookies ( )

Returns cookies set in response

Returns
array

Definition at line 412 of file Response.php.

static HTTP_Request2_Response::getDefaultReasonPhrase (   $code = null)
static

Returns the default reason phrase for the given code or all reason phrases

Parameters
int$codeResponse code
Returns
string|array|null Default reason phrase for $code if $code is given (null if no phrase is available), array of all reason phrases if $code is null http://pear.php.net/bugs/18716

Definition at line 194 of file Response.php.

HTTP_Request2_Response::getEffectiveUrl ( )

Returns the effective URL of the response

This may be different from the request URL if redirects were followed.

Returns
string http://pear.php.net/bugs/bug.php?id=18412

Definition at line 352 of file Response.php.

HTTP_Request2_Response::getHeader (   $headerName = null)

Returns either the named header or all response headers

Parameters
string$headerNameName of header to return
Returns
string|array Value of $headerName header (null if header is not present), array of all response headers if $headerName is null

Definition at line 397 of file Response.php.

HTTP_Request2_Response::getReasonPhrase ( )

Returns the reason phrase

Returns
string

Definition at line 372 of file Response.php.

HTTP_Request2_Response::getStatus ( )

Returns the status code

Returns
integer

Definition at line 362 of file Response.php.

HTTP_Request2_Response::getVersion ( )

Get the HTTP version of the response

Returns
string

Definition at line 462 of file Response.php.

HTTP_Request2_Response::isRedirect ( )

Whether response is a redirect that can be automatically handled by HTTP_Request2

Returns
bool

Definition at line 382 of file Response.php.

HTTP_Request2_Response::parseCookie (   $cookieString)
protected

Parses a Set-Cookie header to fill $cookies array

Parameters
string$cookieStringvalue of Set-Cookie header

http://web.archive.org/web/20080331104521/http://cgi.netscape.com/newsref/std/cookie_spec.html

Definition at line 290 of file Response.php.

HTTP_Request2_Response::parseHeaderLine (   $headerLine)

Parses the line from HTTP response filling $headers array

The method should be called after reading the line from socket or receiving it into cURL callback. Passing an empty string here indicates the end of response headers and triggers additional processing, so be sure to pass an empty string in the end.

Parameters
string$headerLineLine from HTTP response

Definition at line 237 of file Response.php.

Member Data Documentation

HTTP_Request2_Response::$body = ''
protected

Definition at line 107 of file Response.php.

HTTP_Request2_Response::$bodyEncoded
protected

Definition at line 117 of file Response.php.

HTTP_Request2_Response::$code
protected

Definition at line 67 of file Response.php.

HTTP_Request2_Response::$cookies = array()
protected

Definition at line 92 of file Response.php.

HTTP_Request2_Response::$effectiveUrl
protected

Definition at line 80 of file Response.php.

HTTP_Request2_Response::$headers = array()
protected

Definition at line 86 of file Response.php.

HTTP_Request2_Response::$lastHeader = null
protected

Definition at line 101 of file Response.php.

HTTP_Request2_Response::$phrases
staticprotected

Definition at line 125 of file Response.php.

HTTP_Request2_Response::$reasonPhrase
protected

Definition at line 74 of file Response.php.

HTTP_Request2_Response::$version
protected

Definition at line 60 of file Response.php.


The documentation for this class was generated from the following file: