Archiving

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
WayneG
Forum Newbie
Posts: 19
Joined: Thu Apr 02, 2009 6:53 am

Archiving

Post 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.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Archiving

Post by JAB Creations »

Make a copy of one page and put it in a different directory?

Here you go! :)
http://php.net/copy
WayneG
Forum Newbie
Posts: 19
Joined: Thu Apr 02, 2009 6:53 am

Re: Archiving

Post 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.
Scriptor
Forum Newbie
Posts: 9
Joined: Fri May 22, 2009 12:27 am

Re: Archiving

Post 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);
?>
 
Post Reply