Recaptcha bugando

Asked

Viewed 26 times

1

Good night, 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 is always returning false, already tried without json_decode too and still nothing! A secret and a public key check!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.