Page 1 of 1

Archiving

Posted: Wed May 20, 2009 5:03 pm
by WayneG
I have a page that I would like to archive in a different directory.
The way I do this at the moment is to copy & paste the source code into a new file, then uploading the file.
Is there a better way?
I would like to click an "archive this page" button, which would magically duplicate this page into a new file with a new filename.
Any ideas would be very welcome.

Re: Archiving

Posted: Wed May 20, 2009 9:27 pm
by JAB Creations
Make a copy of one page and put it in a different directory?

Here you go! :)
http://php.net/copy

Re: Archiving

Posted: Thu May 21, 2009 6:36 pm
by WayneG
Tried using this copy command, but no joy.
The problem I have is the page I want to copy is generated using php.
I only want the html source to be saved as it's for archiving purposes.
I can copy the php file to another php file, but that will still be a dynamic page, which I don't want.
If I copy it to a html page, it doesn't work (the page is created, but the text doesn't print).
Hope this makes sense.
Wayne.

Re: Archiving

Posted: Fri May 22, 2009 12:53 am
by Scriptor
if you want to get generated pages, use

Code: Select all

 
<?
$url=file_get_contents("http://www.google.com/");
$file="google_index.html"; // or what ever you want... 
$fh = fopen($file, 'w+');
fwrite($fh, $url);
fclose($fh);
?>