המטפל המתואר כאן מעבד התקשרות משירות האינטרנט המסך של GrabzIt. כתובת האתר של מטפל זה מועברת ל- GrabzIt ב- callBackURL
פרמטר של Save שִׁיטָה.
עם זאת טכניקה זו תפעל רק אם המטפל נגיש דרך ה- Intארנט.
הפרמטרים הבאים מועברים למטפל כפרמטרים GET.
אם ברצונך לחסום את כל הגישה למטפל, מלבד GrabzIt, השתמש בזה טכניקת אבטחה.
דוגמה זו מראה כיצד ניתן ליישם את מטפל ה- GrabzIt PHP. זה לוכד חמישה פרמטרים שהועברו אליו משירות GrabzIt, כולל המזהה הייחודי של המסך המועבר אל GetResult שִׁיטָה.
לאחר מכן שיטה זו מחזירה את צילום המסך, שהוא saveד בספריית התוצאות. אולם אם א null
ערך מוחזר מ- GetResult שיטה זו מצביעה על כך שהתרחשה שגיאה.
include("GrabzItClient.php"); // This PHP file handles the GrabzIt callback $message = $_GET["message"]; $customId = $_GET["customid"]; $id = $_GET["id"]; $filename = $_GET["filename"]; $format = $_GET["format"]; $targetError = $_GET["targeterror"]; // Custom id can be used to store user ids or whatever is needed for the later processing of the // resulting screenshot $grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); $result = $grabzIt->GetResult($id); if (!$result) { return; } // Ensure that the application has the correct rights for this directory. file_put_contents("results" . DIRECTORY_SEPARATOR . $filename, $result);