How to generate cache of a html page

Discussion in 'PHP' started by ankit_frenz, Jul 4, 2009.

  1. #1
    hi,
    I want to generate a complete cache of web pages.I can use curl to grab pages.But that will only read the HTML part..i need a copy of images,css and others and also the relative links in the HTML changed..any suggestions for this or any free scripts available for this?
    thanks
     
    ankit_frenz, Jul 4, 2009 IP
  2. neegeris

    neegeris Banned

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Its simple to create, u can do this without curl, you can use file_get_contents, and then preg_match for getting all images,css,js, then use fwrite to save files , its simple :)
     
    neegeris, Jul 4, 2009 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    If this is for your own site, you can use something like APC to cache your php pages, which will greatly reduce the load on your server.

    http://www.php.net/apc
     
    jestep, Jul 4, 2009 IP
  4. ankit_frenz

    ankit_frenz Active Member

    Messages:
    1,111
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    63
    #4
    but there are many cases whic arise like:-
    
    href=""
    href=''
    href=
    href=xxx.php
    href=/xxx.php
    
    Code (markup):
    similar is the case with the img tags and all..so wont it become too complicated to find all possiblites and replace them properly as well?
     
    ankit_frenz, Jul 7, 2009 IP
  5. linkstrade

    linkstrade Active Member

    Messages:
    434
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    65
    #5
    thanks for the information dear

    Have a good day
     
    linkstrade, Jul 7, 2009 IP