[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Http/ -> Response.php (summary)

Zend Framework LICENSE

Copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
License: http://framework.zend.com/license/new-bsd New BSD License
Version: $Id$
File Size: 664 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Zend_Http_Response:: (24 methods):
  __construct()
  isError()
  isSuccessful()
  isRedirect()
  getBody()
  getRawBody()
  getVersion()
  getStatus()
  getMessage()
  getHeaders()
  getHeader()
  getHeadersAsString()
  asString()
  __toString()
  responseCodeAsText()
  extractCode()
  extractMessage()
  extractVersion()
  extractHeaders()
  extractBody()
  decodeChunkedBody()
  decodeGzip()
  decodeDeflate()
  fromString()


Class: Zend_Http_Response  - X-Ref

Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It
includes easy access to all the response's different elemts, as well as some
convenience methods for parsing and validating HTTP responses.

__construct($code, $headers, $body = null, $version = '1.1', $message = null)   X-Ref
HTTP response constructor

In most cases, you would use Zend_Http_Response::fromString to parse an HTTP
response string and create a new Zend_Http_Response object.

NOTE: The constructor no longer accepts nulls or empty values for the code and
headers and will throw an exception if the passed values do not form a valid HTTP
responses.

If no message is passed, the message will be guessed according to the response code.

param: int $code Response code (200, 404, ...)
param: array $headers Headers array
param: string $body Response body
param: string $version HTTP version
param: string $message Response code as text

isError()   X-Ref
Check whether the response is an error

return: boolean

isSuccessful()   X-Ref
Check whether the response in successful

return: boolean

isRedirect()   X-Ref
Check whether the response is a redirection

return: boolean

getBody()   X-Ref
Get the response body as string

This method returns the body of the HTTP response (the content), as it
should be in it's readable version - that is, after decoding it (if it
was decoded), deflating it (if it was gzip compressed), etc.

If you want to get the raw body (as transfered on wire) use
$this->getRawBody() instead.

return: string

getRawBody()   X-Ref
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.

return: string

getVersion()   X-Ref
Get the HTTP version of the response

return: string

getStatus()   X-Ref
Get the HTTP response status code

return: int

getMessage()   X-Ref
Return a message describing the HTTP response code
(Eg. "OK", "Not Found", "Moved Permanently")

return: string

getHeaders()   X-Ref
Get the response headers

return: array

getHeader($header)   X-Ref
Get a specific header as string, or null if it is not set

param: string$header
return: string|array|null

getHeadersAsString($status_line = true, $br = "\n")   X-Ref
Get all headers as string

param: boolean $status_line Whether to return the first status line (IE "HTTP 200 OK")
param: string $br Line breaks (eg. "\n", "\r\n", "<br />")
return: string

asString($br = "\n")   X-Ref
Get the entire response as string

param: string $br Line breaks (eg. "\n", "\r\n", "<br />")
return: string

__toString()   X-Ref
Implements magic __toString()

return: string

responseCodeAsText($code = null, $http11 = true)   X-Ref
A convenience function that returns a text representation of
HTTP response codes. Returns 'Unknown' for unknown codes.
Returns array of all codes, if $code is not specified.

Conforms to HTTP/1.1 as defined in RFC 2616 (except for 'Unknown')
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 for reference

param: int $code HTTP response code
param: boolean $http11 Use HTTP version 1.1
return: string

extractCode($response_str)   X-Ref
Extract the response code from a response string

param: string $response_str
return: int

extractMessage($response_str)   X-Ref
Extract the HTTP message from a response

param: string $response_str
return: string

extractVersion($response_str)   X-Ref
Extract the HTTP version from a response

param: string $response_str
return: string

extractHeaders($response_str)   X-Ref
Extract the headers from a response string

param: string $response_str
return: array

extractBody($response_str)   X-Ref
Extract the body from a response string

param: string $response_str
return: string

decodeChunkedBody($body)   X-Ref
Decode a "chunked" transfer-encoded body and return the decoded text

param: string $body
return: string

decodeGzip($body)   X-Ref
Decode a gzip encoded message (when Content-encoding = gzip)

Currently requires PHP with zlib support

param: string $body
return: string

decodeDeflate($body)   X-Ref
Decode a zlib deflated message (when Content-encoding = deflate)

Currently requires PHP with zlib support

param: string $body
return: string

fromString($response_str)   X-Ref
Create a new Zend_Http_Response object from a string

param: string $response_str
return: Zend_Http_Response



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1