Web Content Tips - Part 6: You can read web page or source code of web page over HTTP. It is easy, because PHP have file functions can all be used to read remote files, file_get_contents(). All text from remote file will be stored at a variabel. Sample like this:
<?php
$url = "http://localhost:8048/blog/index.php";
$data = file_get_contents($url) or die("Cannot open URL");
echo $data;
?>
Or you want to force browser download:
<?php
$url = "http://localhost:8048/blog/index.php";
header("Content-Type: plain/text");
$data = file_get_contents($url) or die("Cannot open URL");
echo $data;
?>
advertisements
blog comments powered by Disqus

