Google Recaptcha Internal Error

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?

Answers:

Answer

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

Answer

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.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.