Class HttpResponse
HTTP Response from HttpSocket.
- HttpSocketResponse implements ArrayAccess
- HttpResponse
Deprecated: 3.0.0 This class is deprecated as it has naming conflicts with pecl/http
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/Network/Http/HttpResponse.php
Methods inherited from HttpSocketResponse
__constructsource public
__construct( string $message null )
Constructor
Parameters
- string
$message
optional null - Message to parse.
_decodeBodysource protected
_decodeBody( string $body , string|boolean $encoding 'chunked' )
Generic function to decode a $body with a given $encoding. Returns either an array with the keys 'body' and 'header' or false on failure.
Parameters
- string
$body
- A string containing the body to decode.
- string|boolean
$encoding
optional 'chunked' - Can be false in case no encoding is being used, or a string representing the encoding.
Returns
mixed
Array of response headers and body or false.
_decodeChunkedBodysource protected
_decodeChunkedBody( string $body )
Decodes a chunked message $body and returns either an array with the keys 'body' and 'header' or false as a result.
Parameters
- string
$body
- A string containing the chunked body to decode.
Returns
mixed
Array of response headers and body or false.
Throws
SocketException
SocketException
_parseHeadersource protected
_parseHeader( array $header )
Parses an array based header.
Parameters
- array
$header
- Header as an indexed array (field => value)
Returns
array
Parsed header
_tokenEscapeCharssource protected
_tokenEscapeChars( boolean $hex true , array $chars null )
Gets escape chars according to RFC 2616 (HTTP 1.1 specs).
Parameters
- boolean
$hex
optional true - True to get them as HEX values, false otherwise.
- array
$chars
optional null - Characters to uescape.
Returns
array
Escape chars
_unescapeTokensource protected
_unescapeToken( string $token , array $chars null )
Unescapes a given $token according to RFC 2616 (HTTP 1.1 specs)
Parameters
- string
$token
- Token to unescape.
- array
$chars
optional null - Characters to unescape.
Returns
string
Unescaped token
getHeadersource public
getHeader( string $name , array $headers null )
Get header in case insensitive
Parameters
- string
$name
- Header name.
- array
$headers
optional null - Headers to format.
Returns
mixed
String if header exists or null
offsetExistssource public
offsetExists( string $offset )
ArrayAccess - Offset Exists
Parameters
- string
$offset
- Offset to check.
Returns
boolean
bool
Implementation of
ArrayAccess::offsetExists()
offsetGetsource public
offsetGet( string $offset )
ArrayAccess - Offset Get
Parameters
- string
$offset
- Offset to get.
Returns
mixed
mixed
Implementation of
ArrayAccess::offsetGet()
offsetSetsource public
offsetSet( string $offset , mixed $value )
ArrayAccess - Offset Set
Parameters
- string
$offset
- Offset to set.
- mixed
$value
- Value.
Implementation of
ArrayAccess::offsetSet()
offsetUnsetsource public
offsetUnset( string $offset )
ArrayAccess - Offset Unset
Parameters
- string
$offset
- Offset to unset.
Implementation of
ArrayAccess::offsetUnset()
parseCookiessource public
parseCookies( array $header )
Parses cookies in response headers.
Parameters
- array
$header
- Header array containing one ore more 'Set-Cookie' headers.
Returns
mixed
Either false on no cookies, or an array of cookies received.
parseResponsesource public
parseResponse( string $message )
Parses the given message and breaks it down in parts.
Parameters
- string
$message
- Message to parse
Throws
SocketException
SocketException
Properties inherited from HttpSocketResponse
$contextsource
public array
Context data in the response. Contains SSL certificates for example.
array()
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.7/class-HttpResponse.html