Capture Screenshots in PHP

By Maximus1983 on Jun 27, 2012

Capture Web Screenshots easily with the GrabzIt PHP API. You will need the free GrabzIt PHP Code Library to get started.

For more information on the API visit.

Register to get your free Application Key and Application Secret.

     * The PHP file that takes the picture


    //Create the GrabzItClient class
    //Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
    $grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");
    //Take the picture the method will return the unique identifier assigned to this task
    $id = $grabzIt->TakePicture("", "");

     * The GrabzItHandler file that saves the picture


    $message = $_GET["message"];
    $customId = $_GET["customid"];
    $id = $_GET["id"];
    $filename = $_GET["filename"];

    //Custom id can be used to store user ids or whatever is needed for the later processing of the
    //resulting screenshot

    $grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");
    $result = $grabzIt->GetPicture($id);

    if (!$result)

    //Ensure that the application has the correct rights for this directory.
    file_put_contents("images" . DIRECTORY_SEPARATOR . $filename, $result);


Sign in to comment.
ryangurn   -  Dec 27, 2013

The best application that i have seen for taking screen shots is a nodejs application that can easily called from php... It is called screen shot as service. This is the github for the application.

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.