Recaptcha: invalid-json response

Created on 4 Apr 2016  路  3Comments  路  Source: google/recaptcha

I'm getting a response of invalid-json when I use the test example and the default send option (\ReCaptcha\ReCaptcha($secret)).

\ReCaptcha\RequestMethod\SocketPost() doesn't work on this server (error: Warning: fsockopen(): unable to connect to ssl://www.google.com:443 (Connection timed out)).

\ReCaptcha\RequestMethodCurlPost() just runs and finally quits without a response from the server.

PHP 5.4.28
Linux server
I can post the info.php if needed.

question

Most helpful comment

do it like this:

//$recaptcha = new \ReCaptcha\ReCaptcha($secret);
// If file_get_contents() is locked down on your PHP installation to disallow
// its use with URLs, then you can use the alternative request method instead.
// This makes use of fsockopen() instead.
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());

cheers

All 3 comments

do it like this:

//$recaptcha = new \ReCaptcha\ReCaptcha($secret);
// If file_get_contents() is locked down on your PHP installation to disallow
// its use with URLs, then you can use the alternative request method instead.
// This makes use of fsockopen() instead.
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());

cheers

Hi @Brather , i've tried it and it gives me error 500... any ideas??
thanks

Closing super old issues. Please re-raise if still relevant.

Was this page helpful?
0 / 5 - 0 ratings