捕獲和轉換Web的工具

Perl的GrabzIt處理程序

Perl API

產品描述

在調試處理程序時遇到問題嗎? 嘗試 回調處理程序測試工具。

此處描述的處理程序處理來自GrabzIt屏幕快照Web服務的回調。 該處理程序的URL在以下位置傳遞給GrabzIt: callBackURL 的參數 Save 方法。 但是,只有在可以通過 Int以太網

以下參數作為GET參數傳遞給處理程序。

如果要阻止對處理程序的所有訪問,除了GrabzIt之外,請使用此方法 安全技術.

請記住,如果您的應用程序位於localhost上,則此回調將不起作用。

本示例說明如何實現GrabzIt Perl處理程序。 這會捕獲從GrabzIt服務傳遞給它的五個參數,包括傳遞給 GetResult 方法。

然後,此方法返回屏幕截圖,即 saved在結果目錄中。 但是如果 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;
}