Get started with DeathByCaptcha PHP client in 5 minutes.
- PHP 7.4 or higher
- DeathByCaptcha account (Sign up here)
- Your API username and password
<?php
require_once 'deathbycaptcha.php';
// Set your credentials
$username = 'your_username';
$password = 'your_password';
// Create a client (HTTP is recommended)
$client = new DeathByCaptcha_HttpClient($username, $password);
// Check your balance
$balance = $client->get_balance();
echo "Your balance: $" . number_format($balance, 2) . "\n";<?php
require_once 'deathbycaptcha.php';
$client = new DeathByCaptcha_HttpClient('your_username', 'your_password');
// Upload a CAPTCHA from file
$captcha = $client->decode('path/to/captcha.jpg');
if ($captcha) {
echo "CAPTCHA {$captcha['captcha']} solved: {$captcha['text']}\n";
// If the solution is incorrect, report it
if ($captcha['text'] !== 'expected_text') {
$client->report($captcha['captcha']);
echo "Incorrect CAPTCHA reported\n";
}
} else {
echo "Failed to solve CAPTCHA\n";
}<?php
require_once 'deathbycaptcha.php';
$client = new DeathByCaptcha_HttpClient('your_username', 'your_password');
// reCAPTCHA v2 parameters
$token_params = json_encode([
'googlekey' => 'your_site_key',
'pageurl' => 'https://example.com/page-with-recaptcha'
]);
// Solve reCAPTCHA
$captcha = $client->decode([
'type' => 4, // reCAPTCHA v2 type
'token_params' => $token_params
]);
if ($captcha) {
echo "CAPTCHA {$captcha['captcha']} solved\n";
echo "Token: {$captcha['text']}\n";
// Use $captcha['text'] as the g-recaptcha-response value
} else {
echo "Failed to solve reCAPTCHA\n";
}<?php
require_once 'deathbycaptcha.php';
$client = new DeathByCaptcha_HttpClient('your_username', 'your_password');
// reCAPTCHA v3 parameters
$token_params = json_encode([
'googlekey' => 'your_site_key',
'pageurl' => 'https://example.com/page-with-recaptcha',
'action' => 'submit', // The action name
'min_score' => 0.3 // Minimum score (0.1, 0.3, 0.5, 0.7, or 0.9)
]);
// Solve reCAPTCHA v3
$captcha = $client->decode([
'type' => 5, // reCAPTCHA v3 type
'token_params' => $token_params
]);
if ($captcha) {
echo "Token: {$captcha['text']}\n";
} else {
echo "Failed to solve reCAPTCHA v3\n";
}<?php
require_once 'deathbycaptcha.php';
$client = new DeathByCaptcha_HttpClient('your_username', 'your_password');
// Turnstile parameters
$token_params = json_encode([
'sitekey' => 'your_site_key',
'pageurl' => 'https://example.com/page-with-hcaptcha'
]);
// Solve hCaptcha/Turnstile
$captcha = $client->decode([
'type' => 7, // Turnstile type
'token_params' => $token_params
]);
if ($captcha) {
echo "Token: {$captcha['text']}\n";
} else {
echo "Failed to solve Turnstile\n";
}If you prefer sockets over HTTP:
<?php
require_once 'deathbycaptcha.php';
// Use Socket client instead of HTTP
$client = new DeathByCaptcha_SocketClient('your_username', 'your_password');
// The rest of the code is identical
$balance = $client->get_balance();
echo "Balance: $" . number_format($balance, 2) . "\n";$balance = $client->get_balance();
echo "Current balance: $" . number_format($balance, 2) . "\n";$captcha_id = 12345;
$captcha = $client->get_captcha($captcha_id);
if ($captcha) {
echo "Status: " . ($captcha['is_correct'] ? 'Solved' : 'Pending') . "\n";
echo "Text: {$captcha['text']}\n";
}// Get a refund for incorrectly solved CAPTCHAs
$captcha_id = 12345;
if ($client->report($captcha_id)) {
echo "CAPTCHA reported successfully\n";
}<?php
require_once 'deathbycaptcha.php';
try {
$client = new DeathByCaptcha_HttpClient('username', 'password');
$balance = $client->get_balance();
echo "Balance: $" . number_format($balance, 2) . "\n";
} catch (DeathByCaptcha_AccessDeniedException $e) {
echo "Access denied: Invalid credentials\n";
} catch (DeathByCaptcha_InvalidCaptchaException $e) {
echo "Invalid CAPTCHA: " . $e->getMessage() . "\n";
} catch (DeathByCaptcha_ServiceOverloadException $e) {
echo "Service overloaded, try again later\n";
} catch (DeathByCaptcha_Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}| Type | Service | Description |
|---|---|---|
| 1 | Image CAPTCHA | Standard image-based CAPTCHA |
| 2 | Audio CAPTCHA | Audio-based CAPTCHA |
| 3 | reCAPTCHA v2 (old) | Legacy reCAPTCHA |
| 4 | reCAPTCHA v2 | Google reCAPTCHA v2 (checkbox) |
| 5 | reCAPTCHA v3 | Google reCAPTCHA v3 (score-based) |
| 7 | Turnstile | Cloudflare Turnstile / hCaptcha |
| 8 | FunCaptcha | Arkose Labs FunCaptcha |
| 9 | GeeTest | GeeTest CAPTCHA v3/v4 |
Check the examples/ directory for complete working examples:
example.Normal_Captcha.php- Basic image CAPTCHAexample.reCAPTCHA_v2.php- Google reCAPTCHA v2example.reCAPTCHA_v3.php- Google reCAPTCHA v3example.Turnstile.php- Cloudflare Turnstileexample.Geetest_v3.php- GeeTest v3example.Geetest_v4.php- GeeTest v4- And many more...
- Full Documentation: README.md
- Installation Guide: INSTALL.md
- API Documentation: https://deathbycaptcha.com/api
- Support Email: info@deathbycaptcha.com
- Always check your balance before solving CAPTCHAs to avoid errors
- Use HTTPS - The client uses secure connections by default
- Report incorrect solutions to get refunds and improve accuracy
- Handle exceptions properly to make your code more robust
- Use HTTP client unless you have specific reasons to use sockets
- Follow the API rate limits to avoid service overload exceptions
Now you're ready to integrate CAPTCHA solving into your PHP applications! 🚀