Il gestore qui descritto elabora i callback dal servizio web screenshot di GrabzIt. L'URL di questo gestore viene passato a GrabzIt in callBackURL
parametro del Save metodo.
Tuttavia questa tecnica funzionerà solo se il gestore è accessibile tramite Internet.
I seguenti parametri vengono passati al gestore come parametri GET.
Se vuoi bloccare tutti gli accessi al gestore, ad eccezione di GrabzIt, usa questo tecnica di sicurezza.
Questo esempio mostra come implementare il gestore GrabzIt Perl. Questo acquisisce cinque parametri passati dal servizio GrabzIt, incluso l'ID univoco dello screenshot che viene passato al GetResult metodo.
Questo metodo quindi restituisce lo screenshot, che è saved nella directory dei risultati. Tuttavia se a null
il valore viene restituito da GetResult Questo metodo indica che si è verificato un errore.
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; }