Recaptcha bugando

1

Good evening, I made this code:

if(isset($_POST["user"]) && isset($_POST["senha"]) && isset($_POST['g-recaptcha-response'])) {  


$res = $_POST["g-recaptcha-response"];

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.google.com/recaptcha/api/siteverify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "secret=...&response=$res",
));

$response = curl_exec($curl);
$response = json_decode($response);

if(isset($response->success) && $response->success) {
header("Location: dash.php");

}
    }else {
        die('<script>alert("Captcha error!"); window.location = "index.php";</script>;');
    }
}

But it's always returning false, I've tried it without json_decode too and still nothing! A secret and a public key check!

    
asked by anonymous 23.08.2018 / 04:06

0 answers