我已经在TYPO3网站中实现了reCaptcha,并且在集成了Google reCaptcha V2 API之后,甚至收到了垃圾邮件。在reCaptcha管理控制台中,我没有看到任何错误和警告消息。我还实现了服务器端验证和验证用户的响应。
但是我不明白为什么集成reCAPTCHA后为什么收到垃圾邮件?
服务器端验证
if(isset($_POST['captcha']) && !empty( $_POST['captcha']) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
$captcha=$_POST['captcha'];
}
if (empty($_POST['captcha'])) {
exit('Please set recaptcha variable');
}
$secret="************************************";
$response = $captcha;
$verify = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secret) . '&response=' . urlencode($response));
$captcha_success=json_decode($verify);
if ($captcha_success->success==false) {
echo '<h2>You are spammer ! This user was not verified by recaptcha.</h2>';
}
else if ($captcha_success->success==true) {
echo '<h2>Thanks for posting </h2>';
}
{
"success": true,
"challenge_ts": timestamp,
"hostname": string,
}