reilag/php-anticaptcha

AntiCaptcha - Is PHP Library for working with Anticapthca services

v1.2.5 2021-04-19 09:51 UTC

This package is auto-updated.

Last update: 2022-07-19 12:36:07 UTC


README

Anticaptcha PHP SDK

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

packages.org · anti-captcha.com

Latest Stable Version Total Downloads License

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

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

use AntiCaptcha\AntiCaptcha;

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

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

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