首页 > 解决方案 > 集成 Google reCAPTCHA v2 后收到垃圾邮件

问题描述

我已经在 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,         
  }

标签: typo3recaptcha

解决方案


推荐阅读