I am currently making a website where simply I want users to be able to screenshot a webpage and then download the image.
So what I need help with is how to screenshot a webpage using php and then save the image on my server.
I have read a few other topics about how to screenshot a page but I can't get it to work.
I am using a linux server (Debian 7.0)
Thanks for help :D
You can use grabz.it
Take Website Screenshots with PHP
Then use it like this:
include("GrabzItClient.class.php"); $grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET"); $grabzIt->SetImageOptions("http://www.google.com"); $grabzIt->SaveTo("google.jpg");
If you don't want to depend on 3rd parties, you can use phantomjs, i.e.:
phantomjs responsive-screenshot.js http://google.com
1- Download responsive-screenshot.js. Check the source code for available options.
2- You can install phantomjs by cloning the github repo:
git clone https://github.com/ariya/phantomjs.git