I am trying to validate Google reCaptcha on my website (I am using godaddy server (cpanel)). But when I try to verify server side, it takes too long, and and then I get a time out.
Can anyone point out what is causing the problem?
if(isset($this->data['g-recaptcha-response']) && !empty($this->data['g-recaptcha-response'])){
$u = "https://www.google.com/recaptcha/api/siteverify?secret=".DataSecret."&response=".$this->data['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR'];
$response = @file_get_contents($u);
$arr = json_decode($response,true);
}
I get this error message:
Warning (2): file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret={XXXXXXXXXX}&response={XXXXXXXXXXXX}&remoteip=xxx.x.xx.xx): failed to open stream: Connection timed out
NOTE: On local host (which is on the same server), file_get_contents
is working. I just have issue with recaptcha.