AZcaptcha/yii2-captcha

CAPTCHAFORUM

Administrator
Captcha recognition for all popular services azcaptcha.com [rucaptcha.com], 2captcha.com, pixodrom.com, captcha24.com, socialink.ru, anti-captcha.com

Peculiarities
  • Suitable for all captcha recognition services that work according to common standards
  • Ease of customization
  • Recognition both by the path to the file and by the link
Installation
The preferred way to install this extension is through composer .

Or run

php composer.phar require --prefer-dist AZcaptcha/yii2-captcha "*"

or add

"Thomanphan/yii2-captchar": "*"

to the file composer.json.

Configuration
Code:
'components' => [
    'captcha' => [
        'class' => 'AZcaptcha\yii2-captcha',
        'pathTmp' => '@app/yii2-captcha',
        'apiKey' => '42eab4119020dbc729f657fef270r546',
    ],
],


Usage
Simple example of use:
Code:
$path = 'path/to/captcha.png';
if (\Yii::$app->captcha->run($path)) {
    $captcha = \Yii::$app->captcha->result();
} else {
    throw new Exception(\Yii::$app->captcha->error());
}
It can also be used if you only have a link to a captcha, but for this method you should specify the path in the configuration for saving captchas (pathTmp):

$url = 'https://vk.com/captcha.php?sid=698254154192&s=1';
if (\Yii::$app->captcha->run($url)) {
    $captcha = \Yii::$app->captcha->result();
} else {
    throw new Exception(\Yii::$app->captcha->error());
}

Documentation https://githubmemory.com/repo/AZcaptcha/yii2-captcha