Countable
, Serializable
, Iterator
The message class builds the foundation for any request and response message.
See http\Client\Request and http\Client\Response, as well as http\Env\Request and http\Env\Response.
int
$type# = http\Message::TYPE_NONENULL
string
$requestMethod# = ""string
$requestUrl# = ""string
$responseStatus# = ""int
$responseCode# = 0string
$httpVersion# = NULL
array
$headers# = NULL
Create a new HTTP message.
void
http\Message::__construct([mixed
$message = NULL
[, bool
$greedy = true
])
Retrieve the message serialized to a string
.
Append the data of $body to the message's body.
Add an header, appending to already existing headers.
http\Message http\Message::addHeader(string
$name, mixed
$value)
Add headers, optionally appending values, if header keys already exist.
http\Message http\Message::addHeaders(array
$headers[, bool
$append = false
])
Implements Countable
.
Implements iterator.
Detach a clone of this message from any message chain.
Retrieve the message's body.
Retrieve a single header, optionally hydrated into a http\Header extending class.
mixed
http\Message::getHeader(string
$header[, string
$into_class = NULL
])
Retrieve all message headers.
Retrieve the HTTP protocol version of the message.
Retrieve the first line of a request or response message.
Retrieve any parent message.
Retrieve the request method of the message.
Retrieve the request URL of the message.
Retrieve the response code of the message.
Retrieve the response status of the message.
Retrieve the type of the message.
Check whether this message is a multipart message based on it's content type.
bool
http\Message::isMultipart([string
&$boundary = NULL
])
Implements Iterator
.
Implements Iterator
.
Prepend message(s) $message to this message, or the top most message of this message chain.
http\Message http\Message::prepend(http\Message $message[, bool
$top = true
])
Reverse the message chain and return the former top-most message.
http\Message http\Messae::reverse()
Implements Iterator
.
Implements Serializable
.
Set the message's body.
Set a single header.
http\Message http\Message::setHeader(string
$header[, mixed
$value = NULL
])
Set the message headers.
http\Message http\Message::setHeaders(array
$headers = NULL
)
Set the HTTP protocol version of the message.
http\Message http\Message::setHttpVersion(string
$http_version)
Set the complete message info, i.e. type and response resp. request information, at once.
http\Message http\Message::setInfo(string
$http_info)
Set the request method of the message.
Set the request URL of the message.
Set the response status code.
http\Message http\Message::setResponseCode(int
$response_code[, bool
$strict = true
])
Set the response status phrase.
http\Message http\Message::setResponseStatus(string
$response_status)
Set the message type and reset the message info.
http\Message http\Message::setType(int
$type)
Splits the body of a multipart message.
Stream the message through a callback
.
http\Message http\Message::toCallback(callable
$callback)
Stream the message into stream $stream, starting from $offset, streaming $maxlen at most.
http\Message http\Message::toStream(resource
$stream)
Retrieve the message serialized to a string
.
string
http\Message::toString([bool
$include_parent = false
])
Implements Serializable
.
void
http\Message::unserualize(string
$data)
Implements Iterator
.
The message body, represented as a PHP (temporary) stream.
class http\Message\Body implements Serializable
The parser which is underlying http\Message.
class http\Message\Parser