Pages

Using Google No captcha Re captcha in your web page 2016

<?php

if(isset($_POST['submit']))
{
$secret = "XXXXXXXXXXXXXXXXXXXXX"; //secret key

$response = $_POST['g-recaptcha-response']; // captcha response

$remoteip = $_SERVER['REMOTE_ADDR']; // get user ip

$url = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip"); // pass values to recapcha API

$result = json_decode($url, TRUE);

if($result['success']==1)
{
echo "SUCCESS"
}
else{
echo "failed"
}

}

No comments:

Post a Comment

Search This Blog