July 23, 2014 4:20 am

How to capture website screenshot with PHP

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.

How to capture website screenshot with PHP

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.


Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.

Tutorial Categories:

7 responses to “How to capture website screenshot with PHP”

  1. Tariq ali says:

    Awesome, But how to remove watermark from captured image ?

  2. Awesome, This is a really nice article, easy to use to capture website screenshot!

  3. Sandip Das says:

    this article is good but there need api key and SECRET code can u help without api key and SECRET code. this article good for home practice not for any real project

  4. Sandip Das says:

    gijo can u help me how to do this and its working thats really good

  5. Adan Chou says:

    How to remove water mark and make better quality of image?

  6. Illahi Bux says:

    thanks to share php capture … such a great !

Leave a Reply

Your email address will not be published. Required fields are marked *