Exemplo n.º 1
0
<?php

include "../src/PHPHttpRequest.php";
// Set error handling
error_reporting(E_ALL | E_STRICT);
PHPHttpRequest::error_handling(PHR_ERROR_HTML);
// Make the request
$phr = new PHPHttpRequest();
$phr->open('GET', 'http://www.google.com');
$phr->send();
if ($phr->error_code) {
    die('error');
}
// Output the response
foreach ($phr->get_all_response_headers() as $name => $value) {
    header($name . ': ' . $value);
}
echo $phr->response_text;
/* End of file index.php */