SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    saving dynamic page as html

    Hi,
    Im sure you can do this, I was just wondering if someone could point me to where I can look up info on it.

    Basically I have a dynamically generated page, that will need to be altered every week. I would like to, every week before the new alterations occur, generate the page with the old info, and save it as a static html file and store it to the server.

    Thanks for your help
    Mike M

  2. #2
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    Germany
    Posts
    550
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you have a php version > 4.3.0 you can use
    PHP Code:

    $site 
    file_get_contents("http://www.yoursite.com/yourpage.php");

    $h fopen('backupdir/yourpage.php.html''w');
    fwrite($h$site);
    fclose($h); 
    with php5 it's even easier
    PHP Code:
    file_put_contents('backupdir/yourpage.php.html'file_get_contents('http://www.yoursite.com/yourpage.php')); 
    hth

  3. #3
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it's only one page, there is no need to write a program for this.
    In your browser, choose File | Save As.

  4. #4
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    Germany
    Posts
    550
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how boring

  5. #5
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi,
    thanks for the help that is great.
    And, no it is not a single page, it is a number of pages, that will have to be saved each week and I dont want to have to do that manually myself.

    Thanks again
    Mike

  6. #6
    SitePoint Evangelist
    Join Date
    Feb 2005
    Posts
    581
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think that what you are looking for is some kind of method of caching. Try searching here for "cach*" as there has been some pretty good posts on this topic in the past. Also, searching Google ("PHP cach*") may turn up some pretty good results.

    Joe

  7. #7
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Daimaju
    if you have a php version > 4.3.0 you can use
    PHP Code:

    $site 
    file_get_contents("http://www.yoursite.com/yourpage.php");

    $h fopen('backupdir/yourpage.php.html''w');
    fwrite($h$site);
    fclose($h); 
    with php5 it's even easier
    PHP Code:
    file_put_contents('backupdir/yourpage.php.html'file_get_contents('http://www.yoursite.com/yourpage.php')); 
    hth

    Is this the equivalent of caching?

  8. #8
    SitePoint Evangelist
    Join Date
    Feb 2005
    Posts
    581
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bruin03
    Is this the equivalent of caching?
    Pretty much.

    Joe


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •