Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to download a website that uses php to generate its pages. If I use

wget --convert-links --mirror --trust-server-names the_website.com

the php files are downloaded as php files. When I open the webpage locally, FF gives me a popup box asking whether I want to open the php file of a page with gedit.

Is there any way to download a full web page as plain html so that I can access them in a browser locally?

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

Alternatively, you can force wget to rename every extension to HTML on download with the --adjust-extension/-E flag:

wget --convert-links --mirror --trust-server-names --adjust-extension the_website.com
share|improve this answer
add comment

They're not actually PHP files though, they just have PHP extensions. There's no simple fix for this. You could rename all the files to .html but then all the links would need fixing too.

The simplest way is to serve the files instead of Firefox opening them directly. You can do that by cding into the directory and then using some python magic:

python -m SimpleHTTPServer 8080

And then opening http://localhost:8080 in your browser.


Again, these aren't real PHP, they're just saved in files that mirror the URL. You don't need to set up PHP and/or Apache (et al) to view them.


Edit: if you have PHP installed you can use PHP's built-in server:

 php -S localhost:8080

That should handle the mimetype issue, but I wouldn't bother if you don't have PHP installed.

share|improve this answer
    
Nice idea, but I think this also simply serves the .php file as a download. –  don.joey Oct 11 '13 at 12:28
    
I can confirm that this does not work. –  don.joey Oct 11 '13 at 12:31
    
Yeah, bloody MIME types. This can be overridden but it's a big fluffy pain in the bottom. –  Oli Oct 11 '13 at 12:38
    
thanks for the update –  don.joey Oct 11 '13 at 13:34
add comment

Httrack is pretty good at downloading entire webpages as static offline-copies.

I've used it a few times with good results.

share|improve this answer
1  
Hi mike, thanks for the suggestion. For some or other reason it did not work out of the box for me and I have no time to check. But it seems promising. –  don.joey Oct 11 '13 at 12:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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