The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Anticaptcha::Request - API requests

SYNOPSIS

  use Anticaptcha::Request;
  my $Anticaptcha = Anticaptcha::Request->new(
    clientKey => '123abc123abc123abc112abc123abc123',
    responce => 'json'
  );

  my $balance_json = $Anticaptcha->getBalance();
  print $balance_json,"\n";

  my $stat_json = $Anticaptcha->getQueueStats({queueId => 1});
  print $stat_json,"\n";

or

  use Anticaptcha::Request;
  my $Anticaptcha = Anticaptcha::Request->new(
    clientKey => '123abc123abc123abc112abc123abc123'
  );

  my $balance = $Anticaptcha->getBalance();
  if($balance->{errorId} == 0){
    print $balance->{balance},"\n";
  }else{
    print "Error gettting balance: ",$balance->{errorDescription},"\n";
  }

CONSTRUCTOR METHOD

$Anticaptcha = Anticaptcha::Request->new( %options )

The following options correspond to attribute methods described below:

  KEY                   DEFAULT               REQUIRED
  -----------           -----------           -----------
  clientKey             undef                 YES
  responce              'hash'
clientKey - string with client key.
responce - string with type of methods responce. Valid values:
  'json' - methods returns string in JSON format,

  'hash' - methods returns JSON decoded hash structure.

METHODS

$Anticaptcha->createTask( %options )

Method for creating a task. See API documentation: https://anticaptcha.atlassian.net/wiki/display/API/createTask+%3A+captcha+task+creating

Options:

  KEY                   DEFAULT               REQUIRED
  -----------           -----------           -----------
  task                  undef                 YES
  softId                undef
  languagePool          undef
task - hash structure with task data.
softId, languagePool - additional parameters.

Example:

  my $task = $Anticaptcha->createTask({
    task => {
      type => 'NoCaptchaTask',
      websiteURL => 'https://SiteWithCaptcha.com/page.html',
      websiteKey => 'See API documentation',
      proxyType => 'http',
      proxyAddress => '192.168.1.1',
      proxyPort => 1212,
      userAgent => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6)'
    },
    languagePool => 'en'
  });
$Anticaptcha->getBalance()

Method for retrieve account balance. See API documentation: https://anticaptcha.atlassian.net/wiki/display/API/getBalance+%3A+retrieve+account+balance

No options available for this method.

Example:

  my $balance = $Anticaptcha->getBalance();
$Anticaptcha->getQueueStats( %options )

Method for obtain queue load statistics. See API documentation: https://anticaptcha.atlassian.net/wiki/display/API/getQueueStats+%3A+obtain+queue+load+statistics

Options:

  KEY                   DEFAULT               REQUIRED
  -----------           -----------           -----------
  queueId               1                     YES
queueId - Id of the queue. Valid values: 1, 2, 3, 4, 5

Example:

  my $stat = $Anticaptcha->getQueueStats({queueId => 2});
  print $stat,"\n";
$Anticaptcha->getTaskResult( %options )

Method for request task result. See API documentation: https://anticaptcha.atlassian.net/wiki/display/API/getTaskResult+%3A+request+task+result

Options:

  KEY                   DEFAULT               REQUIRED
  -----------           -----------           -----------
  taskId                undef                 YES
taskId - ID which was obtained in createTask method.

Example:

  my $result = $Anticaptcha->getTaskResult({taskId => $taskId});
  print $result,"\n";

COPYRIGHT

  Copyright 2016, Alexander Mironov

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.