Google Recaptcha内部错误

时间:2015-01-07 09:43:37

标签: javascript php wordpress recaptcha

我在wordpress实例的页面内使用新的Google reCaptcha API作为联系表单,但在使用Google提供的脚本时使用 API returns a 500 Internal Server Error message 。 /> 所以,我使用此代码使其正常工作

$siteKey = "sitekey";
$secret = "secretkey";
$lang = "it";

$resp = null;
$error = null;

$reCaptcha = new ReCaptcha($secret);

if ($_POST["g-recaptcha-response"]) {
    $resp = $reCaptcha->verifyResponse(
        $_SERVER["REMOTE_ADDR"],
        $_POST["g-recaptcha-response"]
    );
}

,在HTML上:

<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="<?php echo siteKey; ?>"></div>

但是,当我打开那个页面时,我唯一看到的是:

An error occurred:  
An internal error occurred: 50C0C9A3E5F28.AB460A3.4C003672

顺便说一下,在Google Chrome控制台上,我可以点击API脚本生成的网址,当我打开它时,我会看到一个空白页面,上面有我需要的reCaptcha。

这可能是Google reCaptcha API和Wordpress之间的冲突,还是仅仅是API的错误?

2 个答案:

答案 0 :(得分:4)

您收到此错误是因为您没有将您的域放入重新访问管理网站的密钥设置或基本上错误的域名。

答案 1 :(得分:-4)

我已经解决了这个问题,但有趣的是,我不知道如何,我只是重新复制了Google文档中的代码,也许是有错误输入。
无论如何,问题解决了。