View Single Post
  #19  
Old 21st June 2018, 09:14
Napon Napon is offline
Banned
 
Join Date: Feb 2016
P2P
Posts: 522
Default
Quote:
Originally Posted by joeroberts View Post
so Has it been confirmed what I posted did not work? I know Botanicar said that he was not able to test it.
here this one is updated and should work
Code:
<?php 

class TSUE_captcha
{
    private $apiURL = "https://www.google.com/recaptcha/api/siteverify?secret=";
    private $privatekey = "6LfHFTQUAAAARFGHTDGGOyBEj7S";
    public $status = false;
    public $error = "";

    public function verifyCaptcha($recaptcha_challenge_field = "", $recaptcha_response_field = "")
    {
        global $_SERVER, $_POST;
                $ip = $_SERVER['REMOTE_ADDR'];
                $response=file_get_contents($this->apiURL.$this->privatekey."&response=".$_POST["g-recaptcha-response"]."&remoteip=".$ip);
                $responseKeys = json_decode($response,true);         
                $this->status = intval($responseKeys["success"]) !== 1 ? false : true;
                if(!$this->status)
                {
                    $this->error = $responseKeys['error-codes'][0];
                }

        return $this->status;
    }

}
?>
Joe it not working at all mate just done test on it on live host
Reply With Quote