RecognizeCaptchaAG

Gets the text of the specified captcha, recognized with API AntiGate.

Syntax

function RecognizeCaptchaAG(aImage: TCSElement; aKey: string;
  aCaptchaID: integer; aPhrase: integer = 0; aMinLen: integer = 0; aMaxLen: integer = 0;
  aNumeric: integer = 0; aRegSense: integer = 0; aCalc: integer = 0;
  aRussian: integer = 0): string; overload;
 
function RecognizeCaptchaAG(aImage: TCSImage; aKey: string;
  aCaptchaID: integer; aPhrase: integer=0; aMinLen: integer = 0; aMaxLen: integer = 0;
  aNumeric: integer = 0; aRegSense: integer = 0; aCalc: integer = 0;
  aRussian: integer = 0): string; overload;

Parameters

  • aImage
    • type: TCSElement
    • functions: element image of which has to be recognized
  • aImage
    • type: TCSImage
    • functions: image to be recognized
  • aKey
    • type: string
    • functions: API key of AntiGate service
  • aCaptchaID
    • type: integer
    • functions: resulting captcha ID
  • aPhrase
    • type: integer
    • functions: 0 = one word, 1 = captcha has two words
  • aMinLen
    • type: integer
    • functions: 0 = default value, >0 = minimum length of text displayed in a CAPTCHA, the employee must enter
  • aMaxLen
    • type: integer
    • functions: 0 = unlimited, >0 = maximum length of text displayed in a CAPTCHA, the employee must enter
  • aNumeric
    • type: integer
    • functions: 0 = default value, 1 = captcha consists only of digits, 2 = captcha has no digits
  • aRegSense
    • type: integer
    • functions: 0 = register has no values, 1 = register has a value
  • aCalc
    • type: integer
    • назначение: 0 = default value, 1 = mathematical operation of digits displayed in a captcha
  • aRussian
    • type: integer
    • functions: 0 = default value, 1 = show captcha to employee with knowledge of Russian language

Returned value

  • type: string
  • functions: text obtained by recognition

Notes

  • To learn more about API AntiGate click the link
  • If the service AntiGate returns an error, the result of the function is an empty string

Examples

  1. LoadURI('http://www.google.com/recaptcha/learnmore');
    //Get the captcha image
    var image:=GetElement('img',0,['src'],['google.com/recaptcha/']);
    //Send the image to recognize with service AntiGate
    var CaptchaID: integer;
    var captchatext:=RecognizeCaptchaAG(image,'MyAGKey',CaptchaID);
    //If the text is not empty, then enter the text to the input field
    if captchatext<>'' then
    begin
      var input:=GetElement('input',0,['name','id'],['recaptcha_response_field','recaptcha_response_field'],true);
      ClickElement(input);
      TypeIn(captchatext);
    end;
  2. LoadURI('http://www.google.com/recaptcha/learnmore');
    //Send the captcha image
    var image:=GetImage(0,['src'],['google.com/recaptcha/']);
    var CaptchaID: integer;
    //Send the image to recognize with service AntiGate
    var captchatext:=RecognizeCaptchaAG(image,'MyAGKey',CaptchaID);
    //If the text is not empty, then enter the text to the input field
    if captchatext<>'' then
    begin
      var input:=GetElement('input',0,['name','id'],['recaptcha_response_field','recaptcha_response_field'],true);
      ClickElement(input);
      TypeIn(captchatext);
    end;