PHP code example of sabirov / yii2-anti-captcha-v2

1. Go to this page and download the library: Download sabirov/yii2-anti-captcha-v2 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/ */

    

sabirov / yii2-anti-captcha-v2 example snippets


use Sabirov\AntiCaptcha\ImageToText;

$anticaptcha = new ImageToText();
$anticaptcha->setVerboseMode(true); // chatty mode ON
$anticaptcha->setKey( 'YourСlientKey' );
$anticaptcha->setFile( '/path/to/image' );

if ( ! $anticaptcha->createTask() ) {
    $anticaptcha->debout( "API v2 send failed - " . $anticaptcha->getErrorMessage(), "red" );

    return false;
}

$taskId = $anticaptcha->getTaskId();

if ( ! $anticaptcha->waitForResult() ) {
	$anticaptcha->debout( "could not solve captcha", "red" );
	$anticaptcha->debout( $anticaptcha->getErrorMessage() );
} else {
	echo "\nhash result: " . $captcha_result . "\n\n";
}

use Sabirov\AntiCaptcha\NoCaptchaProxyless;

$anticaptcha = new NoCaptchaProxyless();
$anticaptcha->setVerboseMode(true); // chatty mode ON
$anticaptcha->setKey( 'YourСlientKey' );
$anticaptcha->setWebsiteURL( 'https://www.instagram.com/' );
$anticaptcha->setWebsiteKey( '6LebnxwUAAAAAGm3yH06pfqQtcMH0AYDwlsXnh-u' );

if ( ! $anticaptcha->createTask() ) {
	$anticaptcha->debout( "API v2 send failed - " . $anticaptcha->getErrorMessage(), "red" );
	return false;
}

$taskId = $anticaptcha->getTaskId();

if ( ! $anticaptcha->waitForResult() ) {
	$anticaptcha->debout( "could not solve captcha", "red" );
	$anticaptcha->debout( $anticaptcha->getErrorMessage() );
	return false;
} else {
	echo "\nhash result: " . $anticaptcha->getTaskSolution() . "\n\n";
}

php composer.phar