Save Complete HTML Pages with Pure PHP


In order to save complete pages along with all resources such as images, styles and scripts, you could use your browsers, however browsers also save accompanying files in separate folder. For example if you wanted to save some page called sample, browser would save the complete page along with folder named sample_files. Browsers also have their proprietary formats such as MHTML (Mime HTML) for Internet Explorer or MAFF (Mozilla Archive Format) for Firefox but with these you are limited to opening these files in these browsers only which isn’t good or always ideal.

It would be good if one could save all resources of an html page in a single file which can be opened by all browsers which is the html format itself. In order to achieve that, I have created a class that helps you save entire page in a single HTML file along with all its resources, no side folder created, all images, CSS and scripts reside in that single html file which of course can be opened in any browser.

This allows really cool possibilities such as creating your own app allowing to save complete html pages like evernote, creating browser extensions for the same purpose or saving your favorite pages to cloud and more you can put the class to your best use and needs 🙂

Download Class at PHPClasses

Don’t forget to rate the class :p