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:

Read More
<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?

Related posts

Leave a Reply

2 comments

  1. 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.