$headers
$headers : array
Guzzle HTTP response object
$headerFactory : \Guzzle\Http\Message\Header\HeaderFactoryInterface
$params : \Guzzle\Common\Collection
$body : \Guzzle\Http\EntityBodyInterface
__construct(string $statusCode, \Guzzle\Common\ToArrayInterface|array $headers = null, string|resource|\Guzzle\Http\EntityBodyInterface $body = null)
Construct the response
string | $statusCode | The response status code (e.g. 200, 404, etc) |
\Guzzle\Common\ToArrayInterface|array | $headers | The response headers |
string|resource|\Guzzle\Http\EntityBodyInterface | $body | The body of the response |
if an invalid response code is given
setHeaderFactory(\Guzzle\Http\Message\Header\HeaderFactoryInterface $factory) : self
Set the header factory to use to create headers
\Guzzle\Http\Message\Header\HeaderFactoryInterface | $factory |
getParams() : \Guzzle\Common\Collection
Get application and plugin specific parameters set on the message.
getHeader(string $header) : \Guzzle\Http\Message\Header|null
Retrieve an HTTP header by name. Performs a case-insensitive search of all headers.
string | $header | Header to retrieve. |
getHeaders() : \Guzzle\Http\Message\Header\HeaderCollection
Get all headers as a collection
setTokenizedHeader( $header, $data, $token = ';')
$header | ||
$data | ||
$token |
codeCoverageIgnore |
---|
codeCoverageIgnore |
---|
codeCoverageIgnore |
---|
addCacheControlDirective( $directive, $value = true)
$directive | ||
$value |
codeCoverageIgnore |
---|
codeCoverageIgnore |
---|
fromMessage(string $message) : self|boolean
Create a new Response based on a raw response message
string | $message | Response message |
Returns false on error
None found |
None found |
None found |
None found |
getBody(boolean $asString = false) : \Guzzle\Http\EntityBodyInterface|string
Get the response entity body
boolean | $asString | Set to TRUE to return a string of the body rather than a full body object |
None found |
setBody(\Guzzle\Http\EntityBodyInterface|string $body) : self
Set the response entity body
\Guzzle\Http\EntityBodyInterface|string | $body | Body to set |
None found |
setProtocol(string $protocol, string $version) : self
Set the protocol and protocol version of the response
string | $protocol | Response protocol |
string | $version | Protocol version |
None found |
getProtocol() : string
Get the protocol used for the response (e.g. HTTP)
None found |
None found |
getInfo(string $key = null) : array|string|null
Get a cURL transfer information
string | $key | A single statistic to check |
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
None found |
setInfo(array $info) : self
Set the transfer information
array | $info | Array of cURL transfer stats |
None found |
setStatus(integer $statusCode, string $reasonPhrase = '') : self
Set the response status
integer | $statusCode | Response status code to set |
string | $reasonPhrase | Response reason phrase |
when an invalid response code is received
None found |
None found |
None found |
None found |
getReasonPhrase() : string
Get the response reason phrase- a human readable version of the numeric status code
None found |
getAcceptRanges() : string
Get the Accept-Ranges HTTP header
Returns what partial content range types this server supports.
None found |
None found |
getAge() : integer|null
Get the Age HTTP header
Returns the age the object has been in a proxy cache in seconds.
None found |
getAllow() : string|null
Get the Allow HTTP header
Returns valid actions for a specified resource. To be used for a 405 Method not allowed.
None found |
isMethodAllowed(string $method) : boolean
Check if an HTTP method is allowed by checking the Allow response header
string | $method | Method to check |
None found |
None found |
None found |
getContentEncoding() : string|null
Get the Content-Encoding HTTP header
None found |
getContentLanguage() : string|null
Get the Content-Language HTTP header
Returns the language the content is in.
None found |
getContentLength() : integer
Get the Content-Length HTTP header
Returns the length of the response body in bytes
None found |
getContentLocation() : string|null
Get the Content-Location HTTP header
Returns an alternate location for the returned data (e.g /index.htm)
None found |
getContentDisposition() : string|null
Get the Content-Disposition HTTP header
Returns the Content-Disposition header
None found |
getContentMd5() : string|null
Get the Content-MD5 HTTP header
Returns a Base64-encoded binary MD5 sum of the content of the response.
None found |
getContentRange() : string
Get the Content-Range HTTP header
Returns where in a full body message this partial message belongs (e.g. bytes 21010-47021/47022).
None found |
getContentType() : string
Get the Content-Type HTTP header
Returns the mime type of this content.
None found |
isContentType(string $type) : boolean
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.
string | $type | Content type to check against |
None found |
getDate() : string|null
Get the Date HTTP header
Returns the date and time that the message was sent.
None found |
getEtag() : string|null
Get the ETag HTTP header
Returns an identifier for a specific version of a resource, often a Message digest.
None found |
getExpires() : string|null
Get the Expires HTTP header
Returns the date/time after which the response is considered stale.
None found |
getLastModified() : string|null
Get the Last-Modified HTTP header
Returns the last modified date for the requested object, in RFC 2822 format (e.g. Tue, 15 Nov 1994 12:45:26 GMT)
None found |
getLocation() : string|null
Get the Location HTTP header
Used in redirection, or when a new resource has been created.
None found |
getPragma() : \Guzzle\Http\Message\Header|null
Get the Pragma HTTP header
Returns the implementation-specific headers that may have various effects anywhere along the request-response chain.
None found |
getProxyAuthenticate() : string|null
Get the Proxy-Authenticate HTTP header
Authentication to access the proxy (e.g. Basic)
None found |
getRetryAfter() : integer|null
Get the Retry-After HTTP header
If an entity is temporarily unavailable, this instructs the client to try again after a specified period of time.
None found |
getServer() : string|null
Get the Server HTTP header
A name for the server
None found |
getSetCookie() : string|null
Get the Set-Cookie HTTP header
An HTTP cookie.
None found |
getTrailer() : string|null
Get the Trailer HTTP header
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.
None found |
getTransferEncoding() : string|null
Get the Transfer-Encoding HTTP header
The form of encoding used to safely transfer the entity to the user
None found |
getVary() : string|null
Get the Vary HTTP header
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.
None found |
getVia() : string|null
Get the Via HTTP header
Informs the client of proxies through which the response was sent.
None found |
getWarning() : string|null
Get the Warning HTTP header
A general warning about possible problems with the entity body
None found |
getWwwAuthenticate() : string|null
Get the WWW-Authenticate HTTP header
Indicates the authentication scheme that should be used to access the requested entity
None found |
isClientError() : boolean
Checks if HTTP Status code is a Client Error (4xx)
None found |
isError() : boolean
Checks if HTTP Status code is Server OR Client Error (4xx or 5xx)
None found |
isInformational() : boolean
Checks if HTTP Status code is Information (1xx)
None found |
None found |
isServerError() : boolean
Checks if HTTP Status code is Server Error (5xx)
None found |
isSuccessful() : boolean
Checks if HTTP Status code is Successful (2xx | 304)
None found |
canCache() : boolean
Check if the response can be cached based on the response headers
Returns TRUE if the response can be cached or false if not
None found |
getMaxAge() : integer|null
Gets the number of seconds from the current time in which this response is still considered fresh
Returns the number of seconds
None found |
isFresh() : boolean|null
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.
None found |
canValidate() : boolean
Check if the response can be validated against the origin server using a conditional GET request.
None found |
getFreshness() : integer
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.
None found |
json() : array|string|integer|boolean|float
Parse the JSON response body and return an array
if the response body is not in JSON format
None found |
xml() : \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.
if the response body is not in XML format
None found |
getRedirectCount() : integer
Get the redirect count of this response
None found |
setEffectiveUrl(string $url) : self
Set the effective URL that resulted in this response (e.g. the last redirect URL)
string | $url | The effective URL |
None found |
getEffectiveUrl() : string
Get the effective URL that resulted in this response (e.g. the last redirect URL)
None found |
codeCoverageIgnore |
---|
codeCoverageIgnore |
---|
codeCoverageIgnore |
---|