Sitenizi bot saldırılarından korumak için aşağıdaki 3 adımı takip edin.
Web sitenizin </head> kapanış etiketinden hemen önce aşağıdaki script kodunu yerleştirin.
<script src="https://captcha.xdev.tr/widget.js" async defer></script>
Koruma altına almak istediğiniz formun içerisine (örneğin Gönder butonunun hemen üstüne) aşağıdaki HTML kodunu ekleyin. data-sitekey alanına size verilen özel anahtarı yazın.
<form action="post.php" method="POST">
<input type="text" name="isim" required>
<div id="xdev-captcha" data-sitekey="SİZE_ÖZEL_SITE_KEY"></div>
<button type="submit">Gönder</button>
</form>
Formunuzun gönderildiği PHP dosyasında (örn: post.php), kullanıcının gerçekten doğrulamayı geçip geçmediğini kontrol etmek için API sunucumuza istek gönderin:
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$secretKey = "SİZE_ÖZEL_SECRET_KEY";
$captchaResponse = $_POST['xdev-captcha-response'] ?? '';
// xDev API'sine doğrulama isteği gönderiyoruz
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://captcha.xdev.tr/api/verify.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'secret_key' => $secretKey,
'response' => $captchaResponse
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result && $result['success'] === true) {
// Doğrulama başarılı, işlemlere devam edebilirsiniz
echo "Form başarıyla gönderildi!";
} else {
// Doğrulama başarısız, bot algılandı
die("Hata: Captcha doğrulaması başarısız oldu.");
}
}
?>
Sistemimizin stabil çalışması için web sitenizin alan adının paneline eksiksiz ve doğru kaydedildiğinden emin olun. Başka bir alan adından gelen istekler güvenlik protokolümüz gereği reddedilir.