Reputation: 1856
If you look at evernote or use their web clipper browser addon, it can save a webpage completely with all styles and images of page clipped. So for example if I save this very page with it, it will be saved as is.
Does any one have an idea of how evernote does it? I want to do it with either PHP or JavaScript but am not sure how to save a webpage with all styles and images. I know about Internet Explorer's mht format but that's not what evernote does.
So basically it would be great if one can save a webpage with all styles and images (excluding dynamic content such as JS) in single file and be able to open it in any major browser ? Any pointer to such script would also be helpful.
I have also noticed similar thing in Gmail, when you copy any part of page and paste that in Gmail Compose, it renders it as it was or same happens in MS Word too.
Thanks for your help and hints :)
Upvotes: 0
Views: 1386
Reputation: 91497
Replace linked stylesheets with style blocks containing the CSS copied from the linked stylesheets. Replace image sources with data URLs.
Upvotes: 1
Reputation: 34667
Or just shell out a call to wget -mk
and mirror the site:
<?php
system('wget -mk http://foo.com/bar');
?>
Upvotes: 1
Reputation: 458
You could do file_get_contents() and then go and recursively download whatever scripts/images you need.
Upvotes: 0