<?php
$result = file_get_contents('http://google.com');
/* these do the same thing, essentially printing the whole page again
BUT since there are "relative links" and resources missing...
print_r($result);
echo $result
/* source formatted to display properly in html */
$array = explode("\n", $result);
foreach ($array as $value)
{
$sourceline = htmlspecialchars($value, ENT_QUOTES);
echo $sourceline . "<br \>\n";
}
/*
A URL can be used as a filename with this function if the fopen wrappers have been enabled.
$result = file_get_contents('http://google.com');
print_r($result);
for embedded image tracking
Flash called a PHP page that in tuen called file_get_contents () on the ASP page, and then finally echoed whatever the ASP page returned
*/
/* these require the (PECL pecl_http >= 0.1.0) with a lot of http functions installed
$response = http_get("http://google.com", array("useragent"=>' ',"timeout"=>1), $info);
print_r($info);
*/
/*$body = http_get('http://example.com/private_area/', array(httpauth => 'username:password'));
print $body;
*/
?>
echo "<br \> <br \>";
/* display the original page */
// php 5 only: $original = htmlspecialchars_decode($source, ENT_QUOTES);
$str = '!';
$quotes = html_entity_decode($str, ENT_QUOTES);
echo $quotes;
$orig = "I'll \"walk\" the <b>dog</b> now";
$a = htmlentities($orig);
$b = html_entity_decode($a);
echo $a; // I'll "walk" the <b>dog</b> now
echo $b; // I'll "walk" the <b>dog</b> now
echo "<br \> <br \>";
// php5.1 and greater $source = htmlspecialchars($result, ENT_QUOTES);
$source = htmlentities($result, ENT_QUOTES);
echo $source;
$orginal = html_entity_decode($source);
echo $original;