Methods summary
public static
Guzzle\Http\Message\Response |boolean
|
#
fromMessage( string $message )
Create a new Response based on a raw response message
Create a new Response based on a raw response message
Parameters
- $message
- Response message
Returns
|
public
|
|
public
string
|
|
public
|
|
public
|
|
public
Guzzle\Http\EntityBodyInterface |string
|
#
getBody( boolean $asString = false )
Get the response entity body
Get the response entity body
Parameters
- $asString
- Set to TRUE to return a string of the body rather than a full body object
Returns
|
public
Guzzle\Http\Message\Response
|
|
public
Guzzle\Http\Message\Response
|
#
setProtocol( string $protocol, string $version )
Set the protocol and protocol version of the response
Set the protocol and protocol version of the response
Parameters
- $protocol
- Response protocol
- $version
- Protocol version
Returns
|
public
string
|
#
getProtocol( )
Get the protocol used for the response (e.g. HTTP)
Get the protocol used for the response (e.g. HTTP)
Returns
string
|
public
string
|
#
getProtocolVersion( )
Get the HTTP protocol version
Get the HTTP protocol version
Returns
string
|
public
array|string|null
|
#
getInfo( string $key = null )
Get a cURL transfer information
Get a cURL transfer information
Parameters
- $key
- A single statistic to check
Returns
array|string|null Returns all stats if no key is set, a single stat if a key is set, or null if a key
is set and not found
Link
|
public
Guzzle\Http\Message\Response
|
#
setInfo( array $info )
Set the transfer information
Set the transfer information
Parameters
- $info
- Array of cURL transfer stats
Returns
|
public
Guzzle\Http\Message\Response
|
#
setStatus( integer $statusCode, string $reasonPhrase = '' )
Set the response status
Parameters
- $statusCode
- Response status code to set
- $reasonPhrase
- Response reason phrase
Returns
Throws
|
public
integer
|
#
getStatusCode( )
Get the response status code
Get the response status code
Returns
integer
|
public
string
|
#
getMessage( )
Get the entire response as a string
Get the entire response as a string
Returns
string
|
public
string
|
#
getReasonPhrase( )
Get the response reason phrase- a human readable version of the numeric
status code
Get the response reason phrase- a human readable version of the numeric
status code
Returns
string
|
public
string
|
#
getAcceptRanges( )
Get the Accept-Ranges HTTP header
Get the Accept-Ranges HTTP header
Returns
string Returns what partial content range types this server supports.
|
public
integer
|
#
calculateAge( )
Calculate the age of the response
Calculate the age of the response
Returns
integer
|
public
integer|null
|
#
getAge( )
Get the Age HTTP header
Returns
integer|null Returns the age the object has been in a proxy cache in seconds.
|
public
string|null
|
#
getAllow( )
Get the Allow HTTP header
Get the Allow HTTP header
Returns
string|null Returns valid actions for a specified resource. To be used for a 405 Method not allowed.
|
public
boolean
|
#
isMethodAllowed( string $method )
Check if an HTTP method is allowed by checking the Allow response header
Check if an HTTP method is allowed by checking the Allow response header
Parameters
Returns
boolean
|
public
string
|
#
getCacheControl( )
Get the Cache-Control HTTP header
Get the Cache-Control HTTP header
Returns
string
|
public
string
|
#
getConnection( )
Get the Connection HTTP header
Get the Connection HTTP header
Returns
string
|
public
string|null
|
#
getContentEncoding( )
Get the Content-Encoding HTTP header
Get the Content-Encoding HTTP header
Returns
string|null
|
public
string|null
|
#
getContentLanguage( )
Get the Content-Language HTTP header
Get the Content-Language HTTP header
Returns
string|null Returns the language the content is in.
|
public
integer
|
#
getContentLength( )
Get the Content-Length HTTP header
Get the Content-Length HTTP header
Returns
integer Returns the length of the response body in bytes
|
public
string|null
|
#
getContentLocation( )
Get the Content-Location HTTP header
Get the Content-Location HTTP header
Returns
string|null Returns an alternate location for the returned data (e.g /index.htm)
|
public
string|null
|
#
getContentDisposition( )
Get the Content-Disposition HTTP header
Get the Content-Disposition HTTP header
Returns
string|null Returns the Content-Disposition header
|
public
string|null
|
#
getContentMd5( )
Get the Content-MD5 HTTP header
Get the Content-MD5 HTTP header
Returns
string|null Returns a Base64-encoded binary MD5 sum of the content of the response.
|
public
string
|
#
getContentRange( )
Get the Content-Range HTTP header
Get the Content-Range HTTP header
Returns
string Returns where in a full body message this partial message belongs (e.g. bytes 21010-47021/47022).
|
public
string
|
#
getContentType( )
Get the Content-Type HTTP header
Get the Content-Type HTTP header
Returns
string Returns the mime type of this content.
|
public
boolean
|
#
isContentType( string $type )
Checks if the Content-Type is of a certain type. This is useful if the
Content-Type header contains charset information and you need to know if
the Content-Type matches a particular type.
Checks if the Content-Type is of a certain type. This is useful if the
Content-Type header contains charset information and you need to know if
the Content-Type matches a particular type.
Parameters
- $type
- Content type to check against
Returns
boolean
|
public
string|null
|
#
getDate( )
Get the Date HTTP header
Returns
string|null Returns the date and time that the message was sent.
|
public
string|null
|
#
getEtag( )
Get the ETag HTTP header
Returns
string|null Returns an identifier for a specific version of a resource, often a Message digest.
|
public
string|null
|
#
getExpires( )
Get the Expires HTTP header
Get the Expires HTTP header
Returns
string|null Returns the date/time after which the response is considered stale.
|
public
string|null
|
#
getLastModified( )
Get the Last-Modified HTTP header
Get the Last-Modified HTTP header
Returns
string|null Returns the last modified date for the requested object, in RFC 2822 format
(e.g. Tue, 15 Nov 1994 12:45:26 GMT)
|
public
string|null
|
#
getLocation( )
Get the Location HTTP header
Get the Location HTTP header
Returns
string|null Used in redirection, or when a new resource has been created.
|
public
Guzzle\Http\Message\Header |null
|
#
getPragma( )
Get the Pragma HTTP header
Get the Pragma HTTP header
Returns
Guzzle\Http\Message\Header |null Returns the implementation-specific headers that may have various effects anywhere along
the request-response chain.
|
public
string|null
|
#
getProxyAuthenticate( )
Get the Proxy-Authenticate HTTP header
Get the Proxy-Authenticate HTTP header
Returns
string|null Authentication to access the proxy (e.g. Basic)
|
public
integer|null
|
#
getRetryAfter( )
Get the Retry-After HTTP header
Get the Retry-After HTTP header
Returns
integer|null If an entity is temporarily unavailable, this instructs the client to try again after a
specified period of time.
|
public
string|null
|
#
getServer( )
Get the Server HTTP header
Get the Server HTTP header
Returns
string|null A name for the server
|
public
string|null
|
#
getSetCookie( )
Get the Set-Cookie HTTP header
Get the Set-Cookie HTTP header
Returns
string|null An HTTP cookie.
|
public
string|null
|
#
getTrailer( )
Get the Trailer HTTP header
Get the Trailer HTTP header
Returns
string|null The Trailer general field value indicates that the given set of header fields is present in
the trailer of a message encoded with chunked transfer-coding.
|
public
string|null
|
#
getTransferEncoding( )
Get the Transfer-Encoding HTTP header
Get the Transfer-Encoding HTTP header
Returns
string|null The form of encoding used to safely transfer the entity to the user
|
public
string|null
|
#
getVary( )
Get the Vary HTTP header
Returns
string|null Tells downstream proxies how to match future request headers to decide whether the cached
response can be used rather than requesting a fresh one from the origin server.
|
public
string|null
|
#
getVia( )
Get the Via HTTP header
Returns
string|null Informs the client of proxies through which the response was sent.
|
public
string|null
|
#
getWarning( )
Get the Warning HTTP header
Get the Warning HTTP header
Returns
string|null A general warning about possible problems with the entity body
|
public
string|null
|
#
getWwwAuthenticate( )
Get the WWW-Authenticate HTTP header
Get the WWW-Authenticate HTTP header
Returns
string|null Indicates the authentication scheme that should be used to access the requested entity
|
public
boolean
|
#
isClientError( )
Checks if HTTP Status code is a Client Error (4xx)
Checks if HTTP Status code is a Client Error (4xx)
Returns
boolean
|
public
boolean
|
#
isError( )
Checks if HTTP Status code is Server OR Client Error (4xx or 5xx)
Checks if HTTP Status code is Server OR Client Error (4xx or 5xx)
Returns
boolean
|
public
boolean
|
#
isInformational( )
Checks if HTTP Status code is Information (1xx)
Checks if HTTP Status code is Information (1xx)
Returns
boolean
|
public
boolean
|
#
isRedirect( )
Checks if HTTP Status code is a Redirect (3xx)
Checks if HTTP Status code is a Redirect (3xx)
Returns
boolean
|
public
boolean
|
#
isServerError( )
Checks if HTTP Status code is Server Error (5xx)
Checks if HTTP Status code is Server Error (5xx)
Returns
boolean
|
public
boolean
|
#
isSuccessful( )
Checks if HTTP Status code is Successful (2xx | 304)
Checks if HTTP Status code is Successful (2xx | 304)
Returns
boolean
|
public
boolean
|
#
canCache( )
Check if the response can be cached based on the response headers
Check if the response can be cached based on the response headers
Returns
boolean Returns TRUE if the response can be cached or false if not
|
public
integer|null
|
#
getMaxAge( )
Gets the number of seconds from the current time in which this response is still considered fresh
Gets the number of seconds from the current time in which this response is still considered fresh
Returns
integer|null Returns the number of seconds
|
public
boolean|null
|
#
isFresh( )
Check if the response is considered fresh.
Check if the response is considered fresh.
A response is considered fresh when its age is less than or equal to the freshness lifetime (maximum age) of the
response.
Returns
boolean|null
|
public
boolean
|
#
canValidate( )
Check if the response can be validated against the origin server using a conditional GET request.
Check if the response can be validated against the origin server using a conditional GET request.
Returns
boolean
|
public
integer
|
#
getFreshness( )
Get the freshness of the response by returning the difference of the maximum lifetime of the response and the
age of the response (max-age - age).
Get the freshness of the response by returning the difference of the maximum lifetime of the response and the
age of the response (max-age - age).
Freshness values less than 0 mean that the response is no longer fresh and is ABS(freshness) seconds expired.
Freshness values of greater than zero is the number of seconds until the response is no longer fresh. A NULL
result means that no freshness information is available.
Returns
integer
|
public
array|string|integer|boolean|float
|
#
json( )
Parse the JSON response body and return an array
Parse the JSON response body and return an array
Returns
array|string|integer|boolean|float
Throws
|
public
SimpleXMLElement
|
#
xml( )
Parse the XML response body and return a \SimpleXMLElement.
Parse the XML response body and return a \SimpleXMLElement.
In order to prevent XXE attacks, this method disables loading external
entities. If you rely on external entities, then you must parse the
XML response manually by accessing the response body directly.
Returns
Throws
Link
|
public
integer
|
#
getRedirectCount( )
Get the redirect count of this response
Get the redirect count of this response
Returns
integer
|
public
Guzzle\Http\Message\Response
|
#
setEffectiveUrl( string $url )
Set the effective URL that resulted in this response (e.g. the last redirect URL)
Set the effective URL that resulted in this response (e.g. the last redirect URL)
Parameters
Returns
|
public
string
|
#
getEffectiveUrl( )
Get the effective URL that resulted in this response (e.g. the last redirect URL)
Get the effective URL that resulted in this response (e.g. the last redirect URL)
Returns
string
|
public
|
|
public
|
|
public
|
|