Jump to content

save a webpage


pro_se

Recommended Posts

Here's a script that'll do better.
It'll output all the html as it is, AND hook you up with a local hard copy.

[code]<?

//set these yourself//
$newFilename='copy.html';
$url= 'http://dev.mastercontrolprogram.org';


if($f=file_get_contents($url))
{
$loc=$_SERVER['DOCUMENT_ROOT'].'/'.$newFilename;

if( ($copy=fopen($loc,'w')) != FALSE)
{
fwrite($copy,$f);
echo $f;
fclose($copy);
$message= "I think i got it" . $loc;
}
else $message= "couldnt open file";
}
else
$message= "i dont know about ".$url;

echo "<!-- " .$message." -->";
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/35058-save-a-webpage/#findComment-165482
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.