Google Recaptcha Internal Error

人盡茶涼 提交于 2019-12-20 03:34:32

问题


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"]
    );
}

and, on the 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

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.

Could it be a conflict between Google reCaptcha API and Wordpress or is it just an API's error?


回答1:


you got this error because you didn't put in your domain into Key Settings in recaptcha admin site or basically wrong domain.




回答2:


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.



来源:https://stackoverflow.com/questions/27816484/google-recaptcha-internal-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!