PHP code example of unapi / anticaptcha-antigate

1. Go to this page and download the library: Download unapi/anticaptcha-antigate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

unapi / anticaptcha-antigate example snippets



use unapi\anticaptcha\antigate\AntigateService;

$service = new AntigateService([
    'key' => YOUR_ANTIGATE_KEY,
]);


use unapi\anticaptcha\common\task\ImageTask;

echo $service->resolve(
    new ImageTask([
        'body' => file_get_contents(__DIR__ . '/fixtures/captcha/mf4azc.png'),
        'minLength' => 6,
        'maxLength' => 6,
    ])
)->wait()->getCode();


use unapi\anticaptcha\common\task\ReCaptcha2Task;

echo $service->resolve(
    new ReCaptcha2Task([
        'siteUrl' => 'http://mywebsite.com/recaptcha/test.php',
        'siteKey' => '6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16',
    ])
)->wait()->getCode();


use unapi\anticaptcha\antigate\task\NoCaptchaTask;

echo $service->resolve(
   new NoCaptchaTask([
                   'websiteURL' => 'http://mywebsite.com/recaptcha/test.php',
                   'websiteKey' => '6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16',
                   'proxyType' => 'http',
                   'proxyAddress' => '8.8.8.8',
                   'proxyPort' => 8080,
                   'proxyLogin' => 'proxyLoginHere',
                   'proxyPassword' => 'proxyPasswordHere',
                   'userAgent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
               ])
)->wait()->getCode();