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?
Alternatively, you can force
wget
to rename every extension to HTML on download with the--adjust-extension
/-E
flag: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:
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:
That should handle the mimetype issue, but I wouldn't bother if you don't have PHP installed.
Httrack is pretty good at downloading entire webpages as static offline-copies.
I've used it a few times with good results.