· 9 years ago · Jan 25, 2017, 05:42 PM
1$captcha;
2 if(isset($_POST['g-recaptcha-response'])){
3 $captcha=$_POST['g-recaptcha-response'];
4 $isValid = true;
5 }
6 if(!$captcha){
7 $errorMessage = "Please check the Captcha.";
8 $isValid = false;
9 }
10 $secretKey = "6LcpDhMUAAAAAOs8YlIcmbSCusGIifxgcVXeYcI2";
11 $ip = $_SERVER['REMOTE_ADDR'];
12 $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);