【发布时间】:2016-05-04 21:17:30
【问题描述】:
这个问题我已经有一段时间了,我想不通。我的 Google recaptcha 代码似乎可以在某些网站上运行 - 但是当添加到其他网站(甚至同一网站内的其他页面)时,完全相同的代码将不起作用。 当它不起作用时,如果我执行 var_dump($_POST['g-recaptcha-response']); (在第二页上)我得到 NULL。
我的初始/表单代码:
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="xxxxx"></div>
我的验证码:
$gRecaptcha = $_POST['g-recaptcha-response'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=xxxxx&response=".$gRecaptcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if($response.success==false || !$gRecaptcha){
die('xxxx');
}
还有其他人也发布了这个问题,但似乎没有人发布解决方案(他们都只是切换到不同的验证码)。 有什么建议接下来要检查什么?
【问题讨论】: