GrabzIt
Tools to Capture and Convert the Web

Advanced Screenshot Features with PHPPHP API

GrabzIt's PHP API is highly customizable and is able to integrate tightly into your application. It exposes a lot of the inner workings of GrabzIt so you can customize how you use GrabzIt as much as possible. Two examples of this is checking the status of existing screenshots and setting the cookies that GrabzIt will use when taking screenshots or capturing content.

Screenshot Status

Use the GetStatus method to allow your app to check the status of a screenshot, perhaps to see if it is still processing or if it is cached and ready to be used.

$status = $grabzIt.GetStatus(screenShotId);

if ($status->Processing)
{
    // screenshot has not yet been processed
}

if ($status->Cached)
{
    // screenshot is still cached by GrabzIt
}

if ($status->Expired)
{
    // screenshot is no longer on GrabzIt
    // Perhaps output status message?
    die $status->Message;
}

Cookies

Warning At least a Entry Package is required to use Cookies. Try it for free with a 7 day free trial. Then from $5.99 a month, unless cancelled.Start 7 Day Free Trial

Most websites use cookies to control functionality. To enable you to control this aspect of website functionality GrabzIt allows you to set your own custom cookies with the following cookie methods.

// gets an array of cookies for google.com
$cookies = $grabzIt->GetCookies("google.com");

// sets a cookie for the google.com domain
$grabzIt->SetCookie("MyCookie", "google.com", "Any Value You Like");

// deletes the previously set cookie
$grabzIt->DeleteCookie("MyCookie", "google.com");

Display a Capture without Downloading

While we recommend that you download a capture to a web server before displaying it. You can also display any type of capture in a user's browser without downloading it onto your web server. However for this technique to work the user will have to wait for the capture to complete.

Once completed you can send the bytes of the capture returned by the SaveTo method to the response along with the correct mime type.

$grabzIt->URLToImage("http://www.google.com");

header("Content-Type: image/jpeg");
echo $grabzIt->SaveTo();

As you can see in the above example there is no filename being passed to the SaveTo method which makes the method return the contents of the capture.