Hi, I need a php script that could get a webpage address and save it as a file (html or else) on the server. Anyone can help?
you may want to go into more detail. like are you looking more a php script to download the html and save it, or are you looking for something to download the entire page , css, html, flash, images and everything?
How would the script get the webpage address? Would it be entered through a form? And like imvain2 said, do you want to save the webpage as a file or just write the URLs to a file?
No, only the html page, or say, the main page. I'd feed the script the web address and it should save the main page as a specific file, and if needed overwrite it. Because I'd want this script to run frequently over time, so it's annoying to assign a differnt file name or give permission to overwrite the same file each time. Thanks for your help.
function SavePage($url,$filename){ $xml = file_get_contents($url); $fp = fopen($filename,"w"); fwrite($fp,$xml); fclose($fp); } PHP: Just pass the function the url and the full path for the file name Nice clean and simple
Thanks imvain, that script was great! Now, how could i save the output file on another server through ftp? Is it Possible? Thanks again