Forum Moderators: coopster

Message Too Old, No Replies

Saving/Caching Webpages

         

HoboTraveler

6:39 am on Dec 21, 2006 (gmt 0)

10+ Year Member



Hello,

I am looking for a way to save a webpage in full using PHP.

I need to save the page in full (images, scripts etc) from specified URL.

Can someone please point me in the right direction..

TIA

jatar_k

4:59 pm on Dec 21, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



cURL [php.net] might be a place to start

open it
save html
get images
save images
get css and js
save css and js

I would also have a spin through [hotscripts.com...] and [sourceforge.net...] for scripts that might do this

HoboTraveler

10:24 am on Dec 22, 2006 (gmt 0)

10+ Year Member



Hello,

I am able to save the html page with curl. However, curl does not seem to save images.

Is there a way to save the images too?

TIA

jatar_k

4:04 pm on Dec 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could read through the saved page for image names and then save them but you would think someone would have already written this.

take a look through [phpclasses.org...] or maybe even through PEAR and see if there is something. I would also look through the script repositories online. Ihad trouble narrowing the search on 'saving webpages using PHP'. I also spent some time on php.net but couldn't quite find something I liked.

sorry I can't be more help.

mattcg

9:46 am on Dec 24, 2006 (gmt 0)

10+ Year Member



I think that cURL doesn't save the images because it is not an HTML parser. To save the images referenced in the HTML file you need to parse it and download the images separately.