Simple examples HttpMessage
HttpMessage
--FILE--
<?php
echo "-TEST\n";
$m = new HttpMessage(
HTTP/1.1 301rn.
Location: /anywherern.
HTTP/1.1 302rn.
Location: /somewherern.
HTTP/1.1 206 Partial contentrn.
Content-Range: bytes=2-3rn.
Transfer-Encoding: chunkedrn.
rn.
01rn.
Xrn.
0
);
var_dump($m->getResponseStatus());
$x = $m->getParentMessage();
$x = $m->getParentMessage();
$x = $m->getParentMessage();
var_dump($m->getBody());
var_dump(HttpMessage::fromString($m->toString(true))->toString(true));
try {
do {
var_dump($m->toString());
} while ($m = $m->getParentMessage());
} catch (HttpException $ex) {
}
echo "Done\n";
?>
--EXPECTF--
%aTEST
string(15) "Partial content"
string(1) "X"
string(190) "HTTP/1.1 301
Location: /anywhere
HTTP/1.1 302
Location: /somewhere
HTTP/1.1 206 Partial content
Content-Range: bytes=2-3
X-Original-Transfer-Encoding: chunked
Content-Length: 1
X
"
string(119) HTTP/1.1 206 Partial content"
Content-Range: bytes=2-3
X-Original-Transfer-Encoding: chunked
Content-Length: 1
X
"
string(36) HTTP/1.1 302"
Location: /somewhere
"
string(35) HTTP/1.1 301"
Location: /anywhere
|
HTML code for linking to this page:
|