1. Go to this page and download the library: Download redpic/antigate 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/ */
namespace App\Listeners;
use Redpic\Antigate\Events\CaptchaWasRecognized;
use Redpic\Antigate\Jobs\RecognizeCaptcha;
class CaptchaWasRecognizedListener
{
public function handle(CaptchaWasRecognized $event)
{
$event->captcha->getKey(); // Тут текст разгаданной капчи
}
}
namespace App\Listeners;
use Redpic\Antigate\Events\CaptchaWasNotRecognized;
use Redpic\Antigate\Jobs\RecognizeCaptcha;
class CaptchaWasNotRecognizedListener
{
public function handle(CaptchaWasNotRecognized $event)
{
$event->captcha; // Не разгаданная капча
$event->exception; // Исключение вызванное во время работы
/*
Если в этом месте вызвать какое то исключение,
то задание по разгадываю этой капчи снова добавится в очередь
*/
}
}