Google Recaptcha内部错误 [英] Google Recaptcha Internal Error
问题描述
我在wordpress实例的页面内使用新的Google reCaptcha API作为联系表单,但 API返回500内部服务器错误消息
使用Google提供的脚本时。
所以,我正在使用此代码使其正常工作
I'm using the new Google reCaptcha API for a contact form inside a page on my wordpress instance, but the API returns a 500 Internal Server Error message
when using the script given by Google.
So, I'm using this code to make it work
$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>
但是,当我打开那个页面时,我唯一看到的是:
But, when i open that page, the only thing I see is this:
An error occurred:
An internal error occurred: 50C0C9A3E5F28.AB460A3.4C003672
顺便说一句,在谷歌Chrome控制台上,我可以点击API脚本生成的网址,当我打开它时,我会看到一个空白页面reCaptcha我需要。
By the way, on Google Chrome console i can click on the URL generated by the API's script, and, when I open it, I see a blank page with the reCaptcha I needed.
谷歌reCaptcha API和Wordpress之间是否存在冲突,还是只是API的错误?
Could it be a conflict between Google reCaptcha API and Wordpress or is it just an API's error?
推荐答案
我已经解决了这个问题,但有趣的是我不知道如何,我刚刚从Google文档中重新复制代码,也许有一个错误。
无论如何,问题解决了。
I've solved the problem, but the funny thing is that I don't know how, I've just re-copied the code from Google Documentation, maybe there was a mistyping.
Anyway, problem solved.
这篇关于Google Recaptcha内部错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!