The handler described here processes callbacks from the GrabzIt screenshot web service. The URL of this handler is passed to GrabzIt in the
callBackURL parameter of the save method.
However this technique will only work if the handler is accessible via the Internet.
The following parameters are passed to the handler as GET parameters.
If you want to block all access to the handler, except from GrabzIt then use this security technique.
This example shows how a GrabzIt Ruby handler can be implemented. This captures five parameters passed to it from the GrabzIt service, including the unique id of the screenshot which is passed to the get_result method.
This method then returns the screenshot, which is saved in the screenshot directory. However if a
nil value is returned from the get_result method this indicates that an error has occured.
require 'grabzit' class HandlerController < ApplicationController def index message = params[:message] customId = params[:customid] id = params[:id] filename = params[:filename] format = params[:format] targetError = params[:targeterror] grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")%>") result = grabzItClient.get_result(id) if result == nil return end # Ensure that the application has the correct rights for this directory. screenshot = File.new("public/screenshots/"+filename, "wb") screenshot.write(result) screenshot.close end end