PHP Library for working with 2captcha service

CAPTCHAFORUM

Administrator
1653070338106.png


This library will help you to recognize any captcha via specific services.
Easy to install. Easy to use.

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

Install
You can add Anticaptcha as a dependency using the composer.phar CLI:
PHP:
# 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:

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

Recognize captcha
PHP:
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
PHP:
use AntiCaptcha\AntiCaptcha;

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

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

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

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