Forum Moderators: phranque

Message Too Old, No Replies

Duplicate PHP site as static HTML

         

akatinic

1:22 am on May 1, 2009 (gmt 0)

10+ Year Member



I'm looking for a script that can spider a PHP/MySQL site and duplicate it as static HTML. It needs to correctly parse dynamic links (including image src's) within the site and re-create the site as a bunch of static HTML files, JPEGs, JSs, etc. The result should be something similar to Firefoxes "save complete page" function, but done automatically for an entire site. bash, perl, or php would be fine, as probably would python. Does anyone know of such a beast?

(In case you really want to know why: I need to move a site from one host to another quickly, before they bill me for another year's service. I do not want to reinstall the whole dynamic site, as I will be doing that again in a month or two when the next version of the software comes out. So I'm just looking for a quick fix to tide me over.)

idfer

5:43 pm on May 1, 2009 (gmt 0)

10+ Year Member



There are several free "website copy offline" programs out there. They let you take a snapshot of a website for off-line browsing. I think wget with the recursive option does the job too.

Or if you have ftp access to the site, you could download everything, then write a short script (bash, perl, php) that goes through the directory tree and for each HTML file, does a wget / file_get_contents() and replaces the file with the result.

Hope this helps.