PHP code example of deathbycaptcha / deathbycaptcha-api-php
1. Go to this page and download the library: Download deathbycaptcha/deathbycaptcha-api-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/ */
deathbycaptcha / deathbycaptcha-api-php example snippets
$client = new DeathByCaptcha_HttpClient("your_username", "your_password");
$captcha = $client->decode("path/to/captcha.jpg");
if ($captcha) {
echo $captcha["text"];
}
// Username + password (HTTPS transport — encrypted, recommended when security matters)
$client = new DeathByCaptcha_HttpClient($username, $password);
// Username + password (socket transport — faster, lower latency, recommended for high throughput)
// $client = new DeathByCaptcha_SocketClient($username, $password);
// Example result array
[
"captcha" => 123456789,
"text" => "03AOPBWq_...",
"is_correct" => true
]
$client = new DeathByCaptcha_HttpClient($username, $password);
try {
echo "Balance: " . $client->get_balance() . " US cents\n";
$captcha = $client->decode("path/to/captcha.jpg");
if ($captcha) {
echo sprintf("Solved CAPTCHA %d: %s\n", $captcha["captcha"], $captcha["text"]);
// Report only if you are certain the solution is wrong:
// $client->report($captcha["captcha"]);
}
} catch (DeathByCaptcha_AccessDeniedException $e) {
echo "Access denied — check your credentials and/or balance\n";
}
$username = "your_username";
$password = "your_password";
$captcha = $client->decode("images/normal.jpg");
$token_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'googlekey' => 'sitekey',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 4, 'token_params' => $token_params]);
$token_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'googlekey' => 'sitekey',
'pageurl' => 'https://target',
'action' => 'verify',
'min_score' => 0.3,
]);
$captcha = $client->decode(null, ['type' => 5, 'token_params' => $token_params]);
$token_enterprise_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'googlekey' => 'sitekey',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 25, 'token_enterprise_params' => $token_enterprise_params]);
$geetest_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'gt' => 'gt_value',
'challenge' => 'challenge_value',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 8, 'geetest_params' => $geetest_params]);
$geetest_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'captcha_id' => 'captcha_id',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 9, 'geetest_params' => $geetest_params]);
$captcha = $client->decode(null, ['type' => 11, 'textcaptcha' => 'What is two plus two?']);
$turnstile_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'sitekey' => 'sitekey',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 12, 'turnstile_params' => $turnstile_params]);
$audio = base64_encode(file_get_contents('images/audio.mp3'));
$captcha = $client->decode(null, ['type' => 13, 'audio' => $audio, 'language' => 'en']);
$lemin_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'captchaid' => 'CROPPED_xxx',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 14, 'lemin_params' => $lemin_params]);
$capy_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'captchakey' => 'PUZZLE_xxx',
'api_server' => 'https://www.capy.me/',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 15, 'capy_params' => $capy_params]);
$waf_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'sitekey' => 'sitekey',
'pageurl' => 'https://target',
'iv' => 'iv_value',
'context' => 'context_value',
]);
$captcha = $client->decode(null, ['type' => 16, 'waf_params' => $waf_params]);
$siara_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'slideurlid' => 'slide_master_url_id',
'pageurl' => 'https://target',
'useragent' => 'Mozilla/5.0',
]);
$captcha = $client->decode(null, ['type' => 17, 'siara_params' => $siara_params]);
$mtcaptcha_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'sitekey' => 'MTPublic-xxx',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 18, 'mtcaptcha_params' => $mtcaptcha_params]);
$cutcaptcha_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'apikey' => 'api_key',
'miserykey' => 'misery_key',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 19, 'cutcaptcha_params' => $cutcaptcha_params]);
$friendly_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'sitekey' => 'FCMG...',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 20, 'friendly_params' => $friendly_params]);
$datadome_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'pageurl' => 'https://target',
'captcha_url' => 'https://target/captcha',
]);
$captcha = $client->decode(null, ['type' => 21, 'datadome_params' => $datadome_params]);
$tencent_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'appid' => 'appid',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 23, 'tencent_params' => $tencent_params]);
$atb_params = json_encode([
'proxy' => 'http://user:[email protected] :1234',
'proxytype' => 'HTTP',
'appid' => 'appid',
'apiserver' => 'https://cap.aisecurius.com',
'pageurl' => 'https://target',
]);
$captcha = $client->decode(null, ['type' => 24, 'atb_params' => $atb_params]);
bash
composer bash
git clone https://github.com/deathbycaptcha/deathbycaptcha-api-client-php.git
cd deathbycaptcha-api-client-php
bash
cd examples
php example.Normal_Captcha.php
# Balance check (accepts credentials as arguments):
php ../get_balance.php <username> <password> <HTTP|socket>