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.
< ?php
function getContentOfURL($url){
$file = fopen($url, "r");
if($file){
while (!feof ($file)) {
$line .= fread ($file, 1024*50);
}
return $line;
}
}
?>
Usage:
< ?php
$string = getContentOfURL("https://sitename.com/index.htm");
?>
yeah, as easy as that ^_*
Leave a Reply