Kendiniz bu kodları uyarlayabilirsiniz belki de;
function reCaptcha($response)
{
$fields = [
'secret' => 'senin_secret key',
'response' => $response
];
$ch=curl_init('https://www.google.com/recaptcha/api/siteverify');
curl_setopt_array($ch,
[ CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($fields),
CURLOPT_RETURNTRANSFER => TRUE
]);
$result=curl_exec($ch);
curl_close($ch);
return json_decode($result,true);
}
if(isset($_POST['gonder'])){ // Mesaj gönder postunu yakalayın
if(!isset($_POST['g-recaptcha-response']) || empty($_POST['g-recaptcha-response'])) {
echo 'Yoksa sen robot musun?';
}
else {
$result = reCaptcha($_POST['g-recaptcha-response']);
if($result['success']==1) {
//Googleden captcha doğrulandığına dair yanıt geldi ve gönderme işlemlerinizi burada yapabilirsiniz.
}
else echo 'reCaptcha Doğrulamasında Sorun Oluştu';
}
}
Çok teşekkürler deneyeceğim.
Ben başaramadım. Formun olduğu html sayfa ile send.php resimlerini aşağıya yapıştırdım. Zamanınız varsa bakabilirseniz sevinirim.
Html
send.php