Get Content of URL Into String/Variable
Tuesday, October 10th, 2006Here 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 ^_*