css
—
.grecaptcha-badge {
visibility: hidden;
}
html
—-
js
—
//https://www.google.com/recaptcha/api.js?render=6LeT1IkdAAAAALikWkCzPrPeP6hF1ex2UycOtS9K
grecaptcha.ready(function() {
grecaptcha.execute(‘6LeT1IkdAAAAALikWkCzPrPeP6hF1ex2UycOtS9K’, { action: ‘submit’ }).then(function(token) {
var recaptchaResponse = document.getElementById(‘recaptchaResponse’);
recaptchaResponse.value = token;
});
});
.grecaptcha-badge {
visibility: hidden;
}
grecaptcha.ready(function() {
grecaptcha.execute('6LeT1IkdAAAAALikWkCzPrPeP6hF1ex2UycOtS9K', { action: 'submit' }).then(function(token) {
var recaptchaResponse = document.getElementById('recaptchaResponse');
recaptchaResponse.value = token;
});
});
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
$recaptcha_secret = 'VOTRE_CLE_SECRETE';
$recaptcha_response = $_POST['g-recaptcha-response'];
$response = file_get_contents($recaptcha_url . '?secret=' . $recaptcha_secret . '&response=' . $recaptcha_response);
$response_keys = json_decode($response, true);
if (intval($response_keys["success"]) !== 1) {
echo "reCAPTCHA verification failed.";
} else {
echo "reCAPTCHA verification successful.";
}
}