2

I have posted a very similar question today but I would like to ask again with a wget/linux focus. I hope that's all right.

I need to create offline copies of web pages programmatically on a LAMP stack, preferably using PHP. I need the HTML source, attached images and CSS style sheets.

I can run things on the command line, but not install new packages.

I can do a wget --page-requisites on the pages I want to archive. This downloads everything I need, but it does not modify the downloaded HTML and CSS files to point towards the archived files.

I am looking for an extension / Perl script / shell script that modifies the downloaded document(s) to point towards the downloaded resources, or maybe a different, Linux based solution that does this. I already checked, httrack does not seem to be installed on the server ("whereis httrack" returns nothing).

9

Try the --convert-links option:

After the download is complete, convert the links in the document to make them suitable for local viewing. This affects not only the visible hyperlinks, but any part of the document that links to external content, such as embedded images, links to style sheets, hyperlinks to non-HTML content, etc.

1
  • How could I overlook that? I will try it out and report back. – Pekka Nov 29 '09 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.