2017 © Pedro PelΓ‘ez
 

library rucaptcha-client

Useful rucaptcha.com PHP-client with PSR-7 and PSR-3 support.

image

gladyshev/rucaptcha-client

Useful rucaptcha.com PHP-client with PSR-7 and PSR-3 support.

  • Monday, May 28, 2018
  • by gladyshev
  • Repository
  • 2 Watchers
  • 8 Stars
  • 3,117 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 14 Versions
  • 14 % Grown

The README.md

rucaptcha-client

Удобная PHP-ΠΎΠ±Ρ‘Ρ€Ρ‚ΠΊΠ° для сСрвиса распознавания ΠΊΠ°ΠΏΡ‡ΠΈ rucaptcha.com.
ΠžΡ€ΠΈΠ³ΠΈΠ½Π°Π»ΡŒΠ½Π°Ρ докумСнтация доступна ΠΏΠΎ ссылкС., (*1)

Build Status Code Coverage Scrutinizer Code Quality, (*2)

Install

$ composer require --prefer-dist gladyshev/rucaptcha-client "*"

or, (*3)

"require": {
  ...
  "gladyshev/rucaptcha-client": "*"
  ...
}

Examples

Π‘ΠΎΠ»ΡŒΡˆΠ΅ ΠΏΡ€ΠΈΠΌΠ΅Ρ€ΠΎΠ² Π² ΠΏΠ°ΠΏΠΊΠ΅ examples., (*4)

/* Simple */

$rucaptcha = new Rucaptcha\Client('YOUR_API_KEY');

$captchaText = $rucaptcha->recognizeFile('captcha.png');
print_r($captchaText); // h54g6

```php /* Advanced example */, (*5)

$rucaptcha = new Rucaptcha\Client('YOUR_API_KEY', [ 'verbose' => true, 'httpClient' => new \GuzzleHttp\Client(['base_uri' => 'https://2captcha.com']), 'logger' => new \Monolog\Logger('2Captcha', [new StreamHandler('php://stdout')]) ]);, (*6)

$taskIds = [];, (*7)

$taskIds[] = $rucaptcha->sendCaptcha(file_get_contents('captcha1.png')); $taskIds[] = $rucaptcha->sendCaptcha(file_get_contents('captcha2.jpg')); $taskIds[] = $rucaptcha->sendCaptcha(file_get_contents('captcha3.gif'), [ Rucaptcha\Extra::NUMERIC => 1 ]);, (*8)

$results = [];, (*9)

while (count($taskIds) > 0) { // Try get results foreach ($taskIds as $i=>$taskId) {
// Wait 5 sec sleep(5);, (*10)

    $results[$taskId] = $rucaptcha->getCaptchaResult($taskId);

    // false === is not ready, on error we've got an exception
    if ($results[$taskId] === false) {
        continue;
    } else {
        unset($taskIds[$i]);
    }
}

}, (*11)

print_r($results);, (*12)


### Methods of `Rucaptcha\Client` ```php use Rucaptcha\Client; /* Constructor */ Client::__construct($apiKey, array $options = []): void; /* Configuration */ Client::setOptions(array $options): void; // Guzzle PSR-18 HTTP-client Client::setHttpClient(Psr\Http\Client\ClientInterface $client): void; // PSR-3 logger Client::setLogger(Psr\Log\LoggerInterface $logger): void; /* Solving captcha methods */ Client::recognize(string $content, array $extra = []): string; Client::recognizeFile(string $path, array $extra = []): string; Client::sendCaptcha(string $content, array $extra = []): int; Client::getCaptchaResult(int $captchaId): string; Client::getCaptchaResultBulk(array $captchaIds): array; /* Pingback stuff */ Client::addPingback(string $uri): bool; Client::getPingbacks(): array; Client::deletePingback(string $uri): bool; Client::deleteAllPingbacks(): bool; /* Google Recaptcha V2 */ Client::sendRecapthaV2($googleKey, $pageUrl, $extra = []): int Client::recognizeRecapthaV2($googleKey, $pageUrl, $extra = []): string /* Other */ Client::getLastCaptchaId(): string; Client::getBalance(): string; Client::reportGood(string $captchaId): bool; Client::reportBad(string $captchaId): bool;

Client options

ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π’ΠΈΠΏ По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ Π’ΠΎΠ·ΠΌΠΎΠΆΠ½Ρ‹Π΅ значСния
verbose bool false Π’ΠΊΠ»ΡŽΡ‡Π°Π΅Ρ‚/ΠΎΡ‚ΠΊΠ»ΡŽΡ‡Π°Π΅Ρ‚ Π»ΠΎΠ³ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Π² стандартный Π²Ρ‹Π²ΠΎΠ΄
apiKey string '' ΠšΠ»ΡŽΡ‡ API с ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΌ вызываСтся сСрвис
rTimeout integer 5 ΠŸΠ΅Ρ€ΠΈΠΎΠ΄ ΠΌΠ΅ΠΆΠ΄Ρƒ опросами сСрСвСра ΠΏΡ€ΠΈ ΠΏΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠΈ Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚Π° распознавания
mTimeout integer 120 Π’Π°ΠΉΠΌΠ°ΡƒΡ‚ оТидания ΠΎΡ‚Π²Π΅Ρ‚Π° ΠΏΡ€ΠΈ ΠΏΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠΈ Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚Π° распознавания
serverBaseUri string 'http://rucaptcha.com' Π‘Π°Π·ΠΎΠ²Ρ‹ΠΉ URI сСрвиса

Solving options $extra

ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π’ΠΈΠΏ По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ Π’ΠΎΠ·ΠΌΠΎΠΆΠ½Ρ‹Π΅ значСния
phrase integer 0 0 = одно слово
1 = ΠΊΠ°ΠΏΡ‡Π° ΠΈΠΌΠ΅Π΅Ρ‚ Π΄Π²Π° слова
regsense integer 0 0 = рСгистр ΠΎΡ‚Π²Π΅Ρ‚Π° Π½Π΅ ΠΈΠΌΠ΅Π΅Ρ‚ значСния
1 = рСгистр ΠΎΡ‚Π²Π΅Ρ‚Π° ΠΈΠΌΠ΅Π΅Ρ‚ Π·Π½Π°Ρ‡Π΅Π½ΠΈΠ΅
question integer 0 0 = ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π½Π΅ задСйствован
1 = Π½Π° ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΈ Π·Π°Π΄Π°Π½ вопрос, Ρ€Π°Π±ΠΎΡ‚Π½ΠΈΠΊ Π΄ΠΎΠ»ΠΆΠ΅Π½ Π½Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ ΠΎΡ‚Π²Π΅Ρ‚
numeric integer 0 0 = ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π½Π΅ задСйствован
1 = ΠΊΠ°ΠΏΡ‡Π° состоит Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΈΠ· Ρ†ΠΈΡ„Ρ€
2 = ΠšΠ°ΠΏΡ‡Π° состоит Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΈΠ· Π±ΡƒΠΊΠ²
3 = ΠšΠ°ΠΏΡ‡Π° состоит Π»ΠΈΠ±ΠΎ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΈΠ· Ρ†ΠΈΡ„Ρ€, Π»ΠΈΠ±ΠΎ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΈΠ· Π±ΡƒΠΊΠ².
calc integer 0 0 = ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π½Π΅ задСйствован
1 = Ρ€Π°Π±ΠΎΡ‚Π½ΠΈΠΊΡƒ Π½ΡƒΠΆΠ½ΠΎ ΡΠΎΠ²Π΅Ρ€ΡˆΠΈΡ‚ΡŒ матСматичСскоС дСйствиС с ΠΊΠ°ΠΏΡ‡ΠΈ
min_len 0..20 0 0 = ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π½Π΅ задСйствован
1..20 = минимальноС количСство Π·Π½Π°ΠΊΠΎΠ² Π² ΠΎΡ‚Π²Π΅Ρ‚Π΅
max_len 1..20 0 0 = ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π½Π΅ задСйствован
1..20 = максимальноС количСство Π·Π½Π°ΠΊΠΎΠ² Π² ΠΎΡ‚Π²Π΅Ρ‚Π΅
is_russian integer 0 ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ большС Π½Π΅ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ, Ρ‚.ΠΊ. ΠΎΠ½ ΠΎΠ·Π½Π°Ρ‡Π°Π» "ΡΠ»Π°Ρ‚ΡŒ Π΄Π°Π½Π½ΡƒΡŽ ΠΊΠ°ΠΏΡ‡Ρƒ русским исполнитСлям", Π° Π² систСмС находятся Ρ‚ΠΎΠ»ΡŒΠΊΠΎ русскоязычныС исполнитСли. Π‘ΠΌΠΎΡ‚Ρ€ΠΈΡ‚Π΅ Π½ΠΎΠ²Ρ‹ΠΉ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ language, ΠΎΠ΄Π½ΠΎΠ·Π½Π°Ρ‡Π½ΠΎ ΠΎΠ±ΠΎΠ·Π½Π°Ρ‡Π°ΡŽΡ‰ΠΈΠΉ язык ΠΊΠ°ΠΏΡ‡ΠΈ
soft_id string ID Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΠ° прилоТСния. Π Π°Π·Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΡƒ прилоТСния отчисляСтся 10% ΠΎΡ‚ всСх ΠΊΠ°ΠΏΡ‡, ΠΏΡ€ΠΈΡˆΠ΅Π΄ΡˆΠΈΡ… ΠΈΠ· Π΅Π³ΠΎ прилоТСния.
language integer 0 0 = ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π½Π΅ задСйствован
1 = Π½Π° ΠΊΠ°ΠΏΡ‡Π΅ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ кирилличСскиС Π±ΡƒΠΊΠ²Ρ‹
2 = Π½Π° ΠΊΠ°ΠΏΡ‡Π΅ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ латинскиС Π±ΡƒΠΊΠ²Ρ‹
lang string Код языка. Π‘ΠΌ. список ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°Π΅ΠΌΡ‹Ρ… языков.
header_acao integer 0 0 = Π·Π½Π°Ρ‡Π΅Π½ΠΈΠ΅ ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ
1 = in.php пСрСдаст Access-Control-Allow-Origin: * ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ Π² Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠ΅ ΠΎΡ‚Π²Π΅Ρ‚Π°. (НСобходимо для кросс-Π΄ΠΎΠΌΠ΅Π½Π½Ρ‹Ρ… AJAX запросов Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€Π½Ρ‹Ρ… прилоТСниях. Π Π°Π±ΠΎΡ‚Π°Π΅Ρ‚ Ρ‚Π°ΠΊΠΆΠ΅ для res.php.)
textinstructions string ВСкст, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π±ΡƒΠ΄Π΅Ρ‚ ΠΏΠΎΠΊΠ°Π·Π°Π½ Ρ€Π°Π±ΠΎΡ‚Π½ΠΈΠΊΡƒ. ΠœΠΎΠΆΠ΅Ρ‚ ΡΠΎΠ΄Π΅Ρ€ΠΆΠ°Ρ‚ΡŒ Π² сСбС инструкции ΠΏΠΎ Ρ€Π°Π·Π³Π°Π΄ΠΊΠ΅ ΠΊΠ°ΠΏΡ‡ΠΈ. ΠžΠ³Ρ€Π°Π½ΠΈΡ‡Π΅Π½ΠΈΠ΅ - 140 символов. ВСкст Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΠΎ ΡΠ»Π°Ρ‚ΡŒ Π² ΠΊΠΎΠ΄ΠΈΡ€ΠΎΠ²ΠΊΠ΅ UTF-8.
textcaptcha string ВСкстовая ΠΊΠ°ΠΏΡ‡Π°. ΠšΠ°Ρ€Ρ‚ΠΈΠ½ΠΊΠ° ΠΏΡ€ΠΈ этом Π½Π΅ загруТаСтся, Ρ€Π°Π±ΠΎΡ‚Π½ΠΈΠΊ ΠΏΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ тСкст ΠΈ Π²Π²ΠΎΠ΄ΠΈΡ‚ ΠΎΡ‚Π²Π΅Ρ‚ Π½Π° этот тСкст. ΠžΠ³Ρ€Π°Π½ΠΈΡ‡Π΅Π½ΠΈΠ΅ - 140 символов. ВСкст Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΠΎ ΡΠ»Π°Ρ‚ΡŒ Π² ΠΊΠΎΠ΄ΠΈΡ€ΠΎΠ²ΠΊΠ΅ UTF-8.
pingback string URL для автоматичСской ΠΎΡ‚ΠΏΡ€Π°Π²ΠΊΠΈ ΠΎΡ‚Π²Π΅Ρ‚Π° Π½Π° ΠΊΠ°ΠΏΡ‡Ρƒ (callback). URL Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±Ρ‹Ρ‚ΡŒ зарСгистрирован Π½Π° сСрвСрС. Π‘ΠΎΠ»ΡŒΡˆΠ΅ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΈ здСсь.
recaptcha string Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ ΠΏΡ€ΠΈ Ρ€Π°Π±ΠΎΡ‚Π΅ со старым Π°Π»Π³ΠΎΡ€ΠΈΡ‚ΠΌΠΎΠΌ распознования Google Recaptcha V2. Π‘ΠΎΠ»ΡŒΡˆΠ΅ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΈ здСсь.
proxy string Π€ΠΎΡ€ΠΌΠ°Ρ‚: Π»ΠΎΠ³ΠΈΠ½:ΠΏΠ°Ρ€ΠΎΠ»ΡŒ@123.123.123.123:3128 Π‘ΠΎΠ»ΡŒΡˆΠ΅ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΈ ΠΎ прокси здСсь.
proxytype string Π’ΠΈΠΏ вашСго прокси-сСрвСра: HTTP, HTTPS, SOCKS4, SOCKS5.

The Versions

28/05 2018

dev-master

9999999-dev

Useful rucaptcha.com PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

28/05 2018

v1.3.1

1.3.1.0

Useful rucaptcha.com PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

12/09 2017

v1.3.0

1.3.0.0

Useful rucaptcha.com PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

19/05 2017

v1.2.1

1.2.1.0

Useful rucaptcha.com PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

17/04 2017

v1.2.0

1.2.0.0

This is a modern full-featured RuCaptcha PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

25/03 2017

v1.1.0

1.1.0.0

This is a modern full-featured RuCaptcha PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

25/03 2017

v1.0.6

1.0.6.0

This is a modern full-featured RuCaptcha PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

19/03 2017

v1.0.5

1.0.5.0

This is a modern full-featured RuCaptcha PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

16/12 2016

v1.0.4

1.0.4.0

This is a modern full-featured RuCaptcha PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

10/12 2016

v1.0.3

1.0.3.0

This is a modern full-featured RuCaptcha PHP-client with PSR-7 and PSR-3 support.

  Sources   Download

MIT

The Requires

 

The Development Requires

rucaptcha captcha recognition

11/04 2016

v1.0.2

1.0.2.0

This is a modern full-featured RuCaptcha PHP-client based on GuzzleHttp framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

php library client rucaptcha captcha recognition

27/12 2015

v1.0.1

1.0.1.0

This is a modern RuCaptcha API PHP-client based on GuzzleHttp framework.

  Sources   Download

MIT

The Requires

 

php library client rucaptcha captcha recognition

20/12 2015

v1.0.0

1.0.0.0

This is a modern RuCaptcha API PHP-client based on GuzzleHttp framework.

  Sources   Download

MIT

The Requires

 

php library client rucaptcha captcha recognition

19/12 2015

v1.0.0-alpha

1.0.0.0-alpha

  Sources   Download

MIT

The Requires

 

php library client rucaptcha captcha recognition