save html in server by a given URL

Hi :slight_smile:
I have a project ,that required a user to enter URL for any site, then I will save the HTML page for this site in my server (like brwser “save as” in client side) how can I do that?

If you need to save just a HTML page, this is an easy task:
[php]<?php
$url = ‘http://www.site.com/page.html’;
$content = file_get_contents($url);
file_put_contents(‘page.html’,$content);
?>[/php]

But if you want to save all the images, javascript, css, flash, etc. found on this page, you will need to parse page, and save all the related files separately.

Sponsor our Newsletter | Privacy Policy | Terms of Service