Response
class Response
Class that represents an HTTP 1.0 / 1.1 response message.
Methods
Constructor.
Check whether the response in successful
Check whether the response is an error
Check whether the response is a redirection
Get the HTTP response status code
Return a message describing the HTTP response code (Eg. "OK", "Not Found", "Moved Permanently")
Get the response body as string
Get the raw response body (as transfered "on wire") as string
Get the HTTP version of the response
Get the response headers
Get a specific header as string, or null if it is not set
Get all headers as string
Create an EasyRdf\Http\Response object from a HTTP response string
Decode a "chunked" transfer-encoded body and return the decoded text
Decode a gzip encoded message (when Content-encoding = gzip)
Decode a zlib deflated message (when Content-encoding = deflate)
Get the entire response as string
Implements magic __toString()
Details
at line 92
__construct(int $status, array $headers, string $body = null, string $version = '1.1', string $message = null)
Constructor.
at line 115
bool
isSuccessful()
Check whether the response in successful
at line 125
bool
isError()
Check whether the response is an error
at line 135
bool
isRedirect()
Check whether the response is a redirection
at line 145
int
getStatus()
Get the HTTP response status code
at line 156
string
getMessage()
Return a message describing the HTTP response code (Eg. "OK", "Not Found", "Moved Permanently")
at line 166
string
getBody()
Get the response body as string
at line 193
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.
at line 203
string
getVersion()
Get the HTTP version of the response
at line 213
array
getHeaders()
Get the response headers
at line 225
string|array|null
getHeader(string $header)
Get a specific header as string, or null if it is not set
at line 243
string
getHeadersAsString(bool $statusLine = true, string $br = "\n")
Get all headers as string
at line 273
static Response
fromString(string $responseStr)
Create an EasyRdf\Http\Response object from a HTTP response string
at line 329
static string
decodeChunkedBody(string $body)
Decode a "chunked" transfer-encoded body and return the decoded text
at line 359
static string
decodeGzip(string $body)
Decode a gzip encoded message (when Content-encoding = gzip)
Currently requires PHP with zlib support
at line 381
static string
decodeDeflate(string $body)
Decode a zlib deflated message (when Content-encoding = deflate)
Currently requires PHP with zlib support
at line 417
string
asString(string $br = "\n")
Get the entire response as string
at line 427
string
__toString()
Implements magic __toString()