无论文本框是否被单击,我的Recaptcha总是返回true

时间:2019-06-17 07:42:53

标签: php recaptcha

我正在尝试在localhost上验证recaptcha表单,但是无论我是否勾选了该复选框,它总是返回true。这是正确的行为吗?

我的表单脚本

<div class="g-recaptcha" data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"></div>

我的服务器

$secret_key = "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe";
    $request = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret_key.'&response='.$_POST['g-recaptcha-response']);
    $response = json_decode($request);
    var_dump($response->success);
    if($response->success==1){
      echo "Success";
      die();
    }else{
      echo "Fail";
      die();
    }

我正在使用的密钥是默认密钥对,用于与本地主机测试

0 个答案:

没有答案