Get Content of URL Into String/Variable
Here is a simple code to get a content of URL (HTML file) and put it into a variable/string. This is useful for content grabbing, for example.
function getContentOfURL($url){
$file = fopen($url, "r");
if($file){
while (!feof ($file)) {
$line .= fread ($file, 1024*50);
}
return $line;
}
}
?>
Usage:
$string = getContentOfURL("http://sitename.com/index.htm");
?>
yeah, as easy as that ^_*
November 18th, 2006 at 7:59 am
Dengan code diatas apakah halaman web yang dimakasud bisa di grab semua berikut gambarnya ? bagaimana jika kita hanya ingin menampilkan contentnya saja dihalaman website kita, sehingga tidak akan merubah tampilan desain.
December 26th, 2006 at 8:35 am
Hi, this method is very easy.But the url requested can’t be with the same session.
sory, my english is poor.:)