PHP code example of solvercaptcha / solvecaptcha-php
1. Go to this page and download the library: Download solvercaptcha/solvecaptcha-php 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/ */
solvercaptcha / solvecaptcha-php example snippets
$solver = new \SolveCaptcha\SolveCaptcha('YOUR_API_KEY');
$solver = new \SolveCaptcha\SolveCaptcha([
'server' => 'https://solvecaptcha.com',
'apiKey' => 'YOUR_API_KEY',
'defaultTimeout' => 120,
'recaptchaTimeout' => 600,
'pollingInterval' => 10,
]);
$result = $solver->normal('path/to/captcha.jpg');
$result = $solver->text('If tomorrow is Saturday, what day is today?');
$result = $solver->recaptcha([
'sitekey' => '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
'url' => 'https://mysite.com/page/with/recaptcha',
]);
$result = $solver->recaptcha([
'sitekey' => '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
'url' => 'https://mysite.com/page/with/recaptcha',
'version' => 'v3',
]);
$result = $solver->hcaptcha([
'sitekey' => 'bf8ccfbf-6a05-45f6-982a-7a7964c2f50c',
'url' => 'https://portalunico.siscomex.gov.br',
'invisible'=> 0,
'domain' => 'hcaptcha.com',
// 'proxy' => [
// 'type' => 'HTTPS',
// 'uri' => 'login:password@IP_address:PORT'
// ]
]);
$result = $solver->funcaptcha([
'sitekey' => '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
'url' => 'https://mysite.com/page/with/funcaptcha',
]);
$result = $solver->geetest([
'gt' => 'f1ab2cdefa3456789012345b6c78d90e',
'challenge' => '12345678abc90123d45678ef90123a456b',
'url' => 'https://www.site.com/page/',
]);
$result = $solver->geetest_v4([
'captchaId' => '72bf15796d0b69c43867452fea615052',
'url' => 'https://mysite.com/captcha.html',
]);
$result = $solver->keycaptcha([
's_s_c_user_id' => 10,
's_s_c_session_id' => '493e52c37c10c2bcdf4a00cbc9ccd1e8',
's_s_c_web_server_sign' => '9006dc725760858e4c0715b835472f22-pz-',
's_s_c_web_server_sign2' => '2ca3abe86d90c6142d5571db98af6714',
'url' => 'https://www.keycaptcha.ru/demo-magnetic/',
]);
$result = $solver->capy([
'sitekey' => 'PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
'url' => 'http://mysite.com/',
'api_server' => 'https://jp.api.capy.me/',
]);
$result = $solver->grid('path/to/captcha.jpg');
$result = $solver->canvas('path/to/captcha.jpg');
$result = $solver->coordinates('path/to/captcha.jpg');
$result = $solver->rotate('path/to/captcha.jpg');
$result = $solver->audio('path/to/audio.mp3');
$result = $solver->yandex([
'sitekey' => 'Y5Lh0tiycconMJGsFd3EbbuNKSp1yaZESUOIHfeV',
'url' => 'https://rutube.ru',
]);
$result = $solver->lemin([
'captchaId' => 'CROPPED_d3d4d56_73ca4008925b4f83a8bed59c2dd0df6d',
'apiServer' => 'api.leminnow.com',
'url' => 'https://www.site.com/page/',
]);
$result = $solver->turnstile([
'sitekey' => '0x4AAAAAAAChNiVJM_WtShFf',
'url' => 'https://ace.fusionist.io',
]);
$result = $solver->amazon_waf([
'sitekey' => 'AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AF5H1K/siwSLK7RfstKtN5bAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglg',
'url' => 'https://non-existent-example.execute-api.us-east-1.amazonaws.com',
'iv' => 'test_iv',
'context' => 'test_context'
]);
$result = $solver->tencent([
'sitekey' => '123456789',
'url' => 'https://www.site.com/page/',
]);
$result = $solver->mt_captcha([
'sitekey' => 'MTPublic-KzqLY1cKH',
'url' => 'https://solvecaptcha.com/demo/mtcaptcha',
]);
$result = $solver->cutcaptcha([
'misery_key' => 'a1488b66da00bf332a1488993a5443c79047e752',
'api_key' => 'SAb83IIB',
'url' => 'https://example.cc/foo/bar.html',
]);
$result = $solver->friendly_captcha([
'sitekey' => '2FZFEVS1FZCGQ9',
'url' => 'https://example.com/',
]);
$result = $solver->atb_captcha([
'sitekey' => 'af23e041b22d000a11e22a230fa8991c',
'api_server' => 'https://cap.aisecurius.com',
'url' => 'https://example.com/',
]);
$result = $solver->datadome([
'captcha_url' => 'https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAA...P~XFrBVptk&t=fe&referer=https%3A%2F%2Fhexample.com&s=45239&e=c538be..c510a00ea',
'userAgent' => 'https://cap.aisecurius.com',
'url' => 'https://example.com/',
'proxy' => [
'type' => 'HTTPS',
'uri' => 'username:str0ngP@[email protected] :4321',
],
]);
$result = $solver->cybersiara([
'master_url_id' => 'tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
'pageurl' => 'https://demo.mycybersiara.com/',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
]);
$id = $solver->send(['file' => 'path/to/captcha.jpg', ...]);
sleep(20);
$code = $solver->getResult($id);
$balance = $solver->balance();
$solver->report($id, true); // captcha solved correctly
$solver->report($id, false); // captcha solved incorrectly
$result = $solver->recaptcha([
'sitekey' => '6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
'url' => 'https://mysite.com/page/with/recaptcha',
'proxy' => [
'type' => 'HTTPS',
'uri' => 'login:password@IP_address:PORT',
],
]);
try {
$result = $solver->text('If tomorrow is Saturday, what day is today?');
} catch (\SolveCaptcha\Exception\ValidationException $e) {
// invalid parameters passed
} catch (\SolveCaptcha\Exception\NetworkException $e) {
// network error occurred
} catch (\SolveCaptcha\Exception\ApiException $e) {
// api respond with error
} catch (\SolveCaptcha\Exception\TimeoutException $e) {
// captcha is not solved so far
}
bash
git clone https://github.com/solvercaptcha/solvecaptcha-php.git