2017 © Pedro Peláez
 

yii2-extension yii2-anti-captcha-v2

работа с anti-captcha.com через API v.2

image

sabirov/yii2-anti-captcha-v2

работа с anti-captcha.com через API v.2

  • Friday, April 21, 2017
  • by Sabirov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 715 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 56 % Grown

The README.md

Work with anti-captcha.com using API v.2.0

Installation

The preferred way to install this extension is through composer., (*1)

Either run, (*2)

php composer.phar require --prefer-dist sabirov/yii2-anti-captcha-v2 "*"

or add, (*3)

"sabirov/yii2-anti-captcha-v2": "*"

to the require section of your composer.json file., (*4)

Usage

Refer to the Official Documentation, (*5)

ImageToTextTask : solve usual image captcha

A simple example :, (*6)

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";
}

Object structure:, (*7)

Property Set property Type Required Default value Purpose
body setFile($fileName) String Yes - in the set function to pass the absolute path to the image
phrase setPhraseFlag($value) Boolean No false false - no requirements true - worker must enter an answer with at least one "space"
case setCaseFlag($value) Boolean No false false - no requirements true - worker will see a special mark telling that answer must be entered with case sensitivity.
numeric setNumericFlag($value) Integer No 0 0 - no requirements 1 - only number are allowed 2 - any letters are allowed except numbers
math setMathFlag($value) Boolean No false false - no requirements true - worker will see a special mark telling that answer must be calculated
minLength setMinLengthFlag($value) Integer No 0 0 - no requirements >1 - defines minimum length of the answer
maxLength setMaxLengthFlag($value) Integer No 0 0 - no requirements >1 - defines maximum length of the answer

NoCaptchaTask : Google Recaptcha puzzle solving

Refer to the Official Documentation, (*8)

NoCaptchaTaskProxyless : Google Recaptcha puzzle solving without proxies

A simple example :, (*9)

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";
}

Object structure:, (*10)

Property Set property Type Required Purpose
websiteURL setWebsiteURL( $value ) String Yes Address of target web page
websiteKey setWebsiteKey( $value ) String Yes Recaptcha website key

websiteSToken|setWebsiteSToken( $value )|String|No|Secret token for previous version of Recaptcha (now deprecated). In most cases websites use newer version and this token is not required., (*11)

The Versions

21/04 2017

dev-master

9999999-dev

работа с anti-captcha.com через API v.2

  Sources   Download

MIT

The Requires

 

by Dmitriy Sabirov

extension yii2 anti-captcha

11/04 2017

0.0.1

0.0.1.0

работа с anti-captcha.com через API v.2

  Sources   Download

MIT

The Requires

 

by Dmitriy Sabirov

extension yii2 anti-captcha