I have received many requests from my readers to write on screenshot capture with PHP so I have found a service using that service we can take websites screenshots very easily in PHP. Used API’s from GrabzIt for testing in our demo you can get a website’s screenshot by sending a web url.
First of all you need to create your account on Grabz.It and they will give you API keys using these keys you can easily integrate it in your application.
Let’s come to the code:
$grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");// Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
// image screenshot
// PDF screenshot
// capture table(s)
Above code is used to create class object with your account API key and secret after creating object we are calling 3 different methods SetImageOptions used to capture image of given page output, SetPDFOptions used to create PDF of given url and SetTableOptions is used to extract tables from the web page.
To save screenshot in your website use below function:
Use this function after your screenshot call and it will save your results directory make sure that you have given writing rights to that directory.
That’s all for screen capture application I hope it helps you guyz please share it with your friends. Follow us on twitter for more updates.