Return to Snippet

Revision: 57141
at May 17, 2012 23:17 by Maximus1983


Initial Code
/*
 * The PHP file that takes the picture
*/

include("GrabzItClient.class.php");

//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("http://www.google.com", "http://www.example.com/GrabzItHandler.php");

/*
 * The GrabzItHandler file that saves the picture
*/

include("GrabzItClient.class.php");

$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)
{
	return;
}

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

Initial URL
http://grabz.it/api/php

Initial Description
Capture Web Screenshots easily with the [GrabzIt ](http://grabz.it/) PHP API

You will need the free [GrabzIt Code Library](http://grabz.it/api/php/download.aspx) to get started.

Initial Title
Capture Screenshots in PHP

Initial Tags
php

Initial Language
PHP