Tools to Capture and Convert the Web

Capture Websites with our PHP Screenshot API

The diagnostics panel can help you debug your code!

GrabzIt's free website screenshot API offers great flexibility and users can utilize it in various ways. For instance, by calling it from a cronjob or a PHP application. To add website screenshots or HTML to image features to your PHP app, follow these steps for the best results:

  1. Get your free key and secret.
  2. Download the free PHP Library and try out the demo app.
  3. Learn the basics about how GrabzIt's API works. By reading the overview below.

PHP API Overview

To use our screenshot service you will first need to create an instance of the GrabzItClient class. Then pass your application key and application secret from your 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. With the Save method, you specify the URL to the handler.php. This handler will process the callback from the service and save the resulting screenshot.

Always use the SaveTo method on localhost

If a publicly accessible callback handler is not available, use the synchronous SaveTo method instead.

This will make your application wait until it creates the screenshot. So you should only use it where the Save method is not appropriate. Once GrabzIt creates the screenshot, it automatically saved to the specified file path.

$filepath = "images/result.jpg";

More Options

When creating screenshots or converting HTML there are many more advanced options. Including: full page screenshots, configuring the browser width and height, image width and height. Or to specify a delay before creating a capture and select the image format of the screenshot.

GrabzIt also supports creating other file formats such as PDFs, DOCX, Animated GIFs, CSVs, and more. For all these options please see the Client documentation.