वेब कॅप्चर आणि रूपांतरित करण्यासाठी साधने

पर्ल सह GrabzIt हँडलर

पर्ल एपीआय

वर्णन

आपल्या हँडलर डीबग करण्यात समस्या येत आहे? प्रयत्न करा कॉलबॅक हँडलर चाचणी साधन.

येथे वर्णन केलेला हँडलर GrabzIt स्क्रीनशॉट वेब सेवेद्वारे कॉलबॅकवर प्रक्रिया करतो. या हँडलरची URL मध्ये GrabzIt वर दिली गेली आहे callBackURL च्या पॅरामीटर Save पद्धत तथापि हे तंत्र केवळ तेव्हाच कार्य करेल ज्याद्वारे हँडलर प्रवेशयोग्य असेल Intआर्टनेट

खालील पॅरामीटर्स जीईटी पॅरामीटर्स म्हणून हँडलरला दिली आहेत.

आपण GrabzIt शिवाय, हँडलरपर्यंत सर्व प्रवेश अवरोधित करू इच्छित असल्यास हे वापरा सुरक्षा तंत्र.

उदाहरण

लक्षात ठेवा आपला अनुप्रयोग लोकलहोस्ट वर असल्यास कॉलबॅक कार्य करणार नाही.

हे उदाहरण दाखवते की GrabzIt पर्ल हँडलर कसे लागू केले जाऊ शकते. हे GrabzIt सेवेकडून पास केलेले सहा पॅरामीटर्स कॅप्चर करते, ज्यामध्ये स्क्रीनशॉटच्या युनिक आयडीचा समावेश आहे. GetResult पद्धत

ही पद्धत नंतर स्क्रीनशॉट परत करते, जी आहे saveपरिणाम निर्देशिका मध्ये डी. तथापि जर ए null वॅल्यू वरुन मिळते GetResult ही पद्धत सूचित करते की एक त्रुटी आली आहे.

use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser); 
use File::Spec;
use GrabzIt::GrabzItClient;

# This Perl file handles the GrabzIt callback

print "HTTP/1.0 200 OK";
print "Content-type: text/html\r\n\r\n";

$cgi = new CGI;

$message = $cgi->param("message");
$customId = $cgi->param("customid");
$id = $cgi->param("id");
$filename = $cgi->param("filename");
$format = $cgi->param("format");
$targetError = $cgi->param("targeterror");

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

$grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>");
$result = $grabzIt->GetResult($id);

if ($result)
{
        # Ensure that the application has the correct rights for this directory.
        open FILE, ">".File::Spec->catfile("results",$filename) or die $!; 
        binmode FILE;
        print FILE $result; 
        close FILE;
}