$request = new HttpRequest("www.google.com");
if ($request->browseTo("/"))
{
$info = $request->getRequestInfo();
if ($info["statuscode"] == 404)
{
exit("<h1>404 - Not Found</h1>");
}
$header = $request->getRequestHeader();
if (isset($header["Content-type"]))
{
header("Content-type: " . $header["Content-type"]);
}
if (isset($header["Content-length"]))
{
header("Content-length: " . $header["Content-length"]);
}
if (isset($header["Content-disposition"]))
{
header("Content-disposition: " . $header["Content-disposition"]);
}
echo $request->getOutput();
}
else
{
exit("<h1>Could not reach www.google.de");
}
|