我已经为联系表单设置了一个recaptcha系统,它工作得很好,直到我将域名更改为co.in。我确实注册了新域名并获得了新的站点密钥和密钥。该代码在本地运行良好主持人但在网站上却失败了。
Recaptcha div ..当然我正在使用我原来的sitekey和密钥..
<div class="g-recaptcha" data-sitekey="SITE KEY" name="spam"></div>
以下是我获取验证码值的方法
var recaptcha = $("#g-recaptcha-response").val();
以下是我验证验证码
的方法<?Php
include('dbnews.php');
$captcha=mysqli_real_escape_string($nmysqli,$_POST['recaptcha']);
$secretKey = "SECRET KEY";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1)
{
echo 'Failed';
exit;
}
else
echo 'Success';
?>
无论我尝试多少,检查总是响应失败..