捕获和转换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;
}