PHP code example of gladyshev / anticaptcha-client

1. Go to this page and download the library: Download gladyshev/anticaptcha-client 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/ */

    

gladyshev / anticaptcha-client example snippets


"  ...
  "gladyshev/anticaptcha-client": "^2.0"
  ...
}

$configuration = new \Anticaptcha\Configuration(
    getenv('__ANTICAPTCHA_KEY__')
); 

// PSR-18 HTTP-client
$httpClient = new \GuzzleHttp\Client(); 

$client = new \Anticaptcha\Client(
    $configuration, 
    $httpClient
);

$result = $client->resolveImage(__DIR__.'/data/captcha.png');

var_dump($result->solution);

/*
array(2) {
  ["text"]=>
  string(14) "замочка"
  ["url"]=>
  string(43) "http://69.39.235.18/510/164683106482493.gif"
}
*/