Captcha non rempli.";
exit;
}
$data = array(
'secret' => 'ES_5d7cd2504595428f866ce15f0715968a',
'response' => $captcha,
'remoteip' => $_SERVER['REMOTE_ADDR']
);
$options = array(
'http' => array (
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$verify = file_get_contents("https://hcaptcha.com/siteverify", false, $context);
$response = json_decode($verify);
if ($response->success) {
echo "Captcha validé, formulaire envoyé !
";
// Ici, traite les données du formulaire (ex: enregistrement, envoi d'email, etc.)
} else {
echo "Échec du captcha.
";
}
}
?>