Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxlen/anticaptcha
Wrapper for anti-captcha.com
https://github.com/maxlen/anticaptcha
Last synced: 3 days ago
JSON representation
Wrapper for anti-captcha.com
- Host: GitHub
- URL: https://github.com/maxlen/anticaptcha
- Owner: maxlen
- Created: 2016-11-14T18:16:33.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-05T13:51:08.000Z (almost 8 years ago)
- Last Synced: 2024-10-29T02:39:16.082Z (18 days ago)
- Language: PHP
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# anticaptcha-php
Wrapper for anti-captcha.com
## Installation:
```php
composer require maxlen/anticaptcha
```### Use for captcha ImageToText:
```php
$resCaptcha = new CaptchaService(
$apiKey, // your apiKey from anti-captcha.com
CaptchaService::TYPE_IMAGE_TO_TEXT,
['imgPath' => '/home/user/example.png'] // path to captcha image
);echo $resCaptcha->check(); // text-result
// or
$resCaptcha->check();
echo $resCaptcha->hashResult; // text-result
```### Use for reCaptcha:
```php
// $html - it's html-code from $url
// $html = file_get_contents($url) or something like thatif (Captcha::isCaptcha($html)) {
$html = self::CaptchaProc($url, $html);
die('CAPTCHA RESOLVED');
}private function CaptchaProc($url, $html)
{
$resCaptcha = new CaptchaService(
$apiKey, // your apiKey from anti-captcha.com
CaptchaService::TYPE_NO_CAPTCHA_PROXYLESS,
[
'webSiteUrl' => $url,
'html' => $html,
]
);// echo PHP_EOL . "getWebSiteKey: " . $resCaptcha->getWebSiteKey();
// echo PHP_EOL . "getWebSiteSToken: " . $resCaptcha->getWebSiteSToken();
// echo PHP_EOL;
// var_dump($resCaptcha->getResolveGetParams());if (!$resCaptcha->check()) {
return false;
}$resolveUrl = $url . '&g-recaptcha-response=' . $resCaptcha->hashResult;
return file_get_contents($resolveUrl); // curl or something like that
}
```