reilag / php-anticaptcha

CAPTCHAFORUM

Administrator
php[1].jpg

PHP client for Anticaptcha services:
Install
You can add Anticaptcha as a dependency using the composer.phar CLI:

# Install Composer (if need)
curl -sS https://getcomposer.org/installer | php

# Add dependency
composer require reilag/php-anticaptcha:^1.2.3
After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';
You can find some examples at /example path.

Recognize captcha
Code:
use AntiCaptcha\AntiCaptcha;



// Get file content

$image = file_get_contents(realpath(dirname(__FILE__)) . '/images/image.jpg');



// Your API key

$apiKey = '*********** API_KEY **************';



$antiCaptchaClient = new AntiCaptcha(

    AntiCaptcha::SERVICE_ANTICAPTCHA,

    [

        'api_key' => $apiKey,

        'debug' => true

    ]

);



echo $antiCaptchaClient->recognize($image, null, ['phrase' => 0, 'numeric' => 0]);

Get balance
Code:
use AntiCaptcha\AntiCaptcha;



$apiKey = '*********** API_KEY **************';



$service = new \AntiCaptcha\Service\AntiCaptcha($apiKey);

$antiCaptchaClient = new \AntiCaptcha\AntiCaptcha($service);



echo "Your Balance is: " . $antiCaptchaClient->balance() . "\n";

Documentation https://packagist.org/packages/reilag/php-anticaptcha