여기에 설명 된 핸들러는 GrabzIt 스크린 샷 웹 서비스에서 콜백을 처리합니다. 이 핸들러의 URL은 GrabzIt에 전달됩니다. callBackURL
의 매개 변수 save 방법.
그러나이 기술은 핸들러를 통해 액세스 할 수있는 경우에만 작동합니다. Internet.
다음 매개 변수는 GET 매개 변수로 핸들러에 전달됩니다.
GrabzIt을 제외하고 핸들러에 대한 모든 액세스를 차단하려면 이것을 사용하십시오. 보안 기술.
이 예제는 GrabzIt Ruby 핸들러를 구현하는 방법을 보여줍니다. 이것은 GrabzIt 서비스에서 전달 된 5 개의 매개 변수를 캡처합니다. get_result 방법.
그런 다음이 메소드는 스크린 샷을 반환합니다. save스크린 샷 디렉토리의 d 그러나 nil
에서 값이 반환됩니다 get_result 이 방법은 오류가 발생했음을 나타냅니다.
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