يعالج المعالج الموضح هنا عمليات الاسترجاعات من خدمة GrabzIt screenshot على الويب. يتم تمرير عنوان URL لهذا المعالج إلى GrabzIt في callBackURL
المعلمة من Save الأسلوب.
ومع ذلك ، ستعمل هذه التقنية فقط إذا كان المعالج يمكن الوصول إليه عبر Internet.
يتم تمرير المعلمات التالية إلى المعالج كمعلمات GET.
إذا كنت ترغب في حظر كل الوصول إلى المعالج ، باستثناء GrabzIt ، فاستخدم هذا تقنية الأمان.
يوضح هذا المثال كيف يمكن تنفيذ معالج GrabzIt Perl. هذا يلتقط خمس معلمات مرت عليها من خدمة 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; }