1

I am trying to verify the google Recaptcha but unable to verify it.I have used this link for library files. https://github.com/google/recaptcha/tree/master/src

$secret = '6Ld0AgkTAAAAAMRP-feRtUN9qZdIkKOy5V9X_DPW';
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new 
\ReCaptcha\RequestMethod\SocketPost());
$gRecaptchaResponse = $_POST['g-recaptcha-response'];
$remoteIp = $_SERVER['REMOTE_ADDR']; //to get user's ip
$recaptchaErrors = ''; // blank varible to store error

$resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp);

I am gettingenter image description here connection failure error.

I have taken a reference of this link also. NoCaptcha returning error invalid-json

swapnil jain
  • 252
  • 1
  • 3
  • 22
  • Well `connection-failed` most likely means it could not make the outgoing request at all, so go check whether those are allowed on your system to begin with, if there’s any firewalls that might be blocking this, etc. – 04FS Nov 12 '19 at 11:56
  • Refer https://stackoverflow.com/questions/27274157/new-google-recaptcha-with-checkbox-server-side-php – pearl Nov 12 '19 at 12:54

0 Answers0