Tools to Capture and Convert the Web

Take Website Screenshots with PHPPHP API

The diagnostics panel can help you debug your code!

GrabzIt's API is very flexible and can be called in many ways such as from a cronjob or a PHP web page. The best way to put website screenshots or HTML to image functionality into your PHP application is by following these steps:

  1. Get your free Application Key and Secret.
  2. Download the free PHP Library and try out the Demo Application.
  3. Find out the basics about how GrabzIt's API works by reading the below overview.

PHP API Overview

To use the API you will first need to create an instance of the GrabzItClient class, passing your application key and application secret from your GrabzIt account to the constructor.


// Create the GrabzItClient class
// Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

Then use one of the image, PDF, animation or table methods to capture a URL or convert HTML.

// To take a image screenshot
// Or to take a PDF screenshot
// Or to convert online videos into animated GIF's
// Or to capture table(s)
// To convert HTML into a image
$grabzIt->HTMLToImage("<html><body><h1>Hello World!</h1></body></html>"); 	
// Or convert HTML into a PDF document
$grabzIt->HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>");
// Or convert HTML into a CSV, XLSX or JSON document
// To convert HTML file into a image
// Or convert HTML file into a PDF document
// Or convert HTML file into a CSV, XLSX or JSON document

Next use one of the following save methods. As you can see with the Save method the URL to the handler.php is specified this handler will process the callback from the service and save the resulting screenshot.


Alternatively if a publicly accessible callback handler is not available the synchonous SaveTo method can be used. This will force your application to wait while the screenshot is created so it should only be used were the Save method is not appropriate. Once the screenshot has been created it is automatically saved to the specified file path.

$filepath = "images/result.jpg";

More Options

When creating screenshots or converting HTML there are many more customizable options including; configuring the browser height, browser width, image height, image width, the delay before a screenshot is taken and the image format of the screenshot. However we also support creating PDF's, Animated GIF's, CSV's and more. For all these options please see the Client documentation.

Try all our premium features for free with a 7 day free trial. Then from $5.99 a month, unless cancelled.
  • More Captures
  • More Features
  • More API's
  • Bigger Scrapes
  • Bigger Captures
  • Bigger Everything
Start Free Trial