PHP Classes
elePHPant
Icontem

File: handler.php

Recommend this page to a friend!
  Classes of GrabzIt  >  GrabzIt PHP Library  >  handler.php  >  Download  
File: handler.php
Role: Example script
Content type: text/plain
Description: An example of a GrabzIt handler
Class: GrabzIt PHP Library
Take screenshots of Web pages using GrabzIt
Author: By
Last change:
Date: 3 years ago
Size: 670 bytes
 

Contents

Class file image Download
<?php
include("lib/GrabzItClient.class.php");
include(
"config.php");

//This PHP file handles the GrabzIt callback

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

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

$grabzIt = new GrabzItClient($grabzItApplicationKey, $grabzItApplicationSecret);
$result = $grabzIt->GetResult($id);

if (!
$result)
{
   return;
}

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