· 6 years ago · Oct 10, 2019, 01:54 PM
1public function captcha_check($captcha){
2
3 $secretKey = "6Ld9dTsUAAAAAFSlUdXlSmvgaDAjULXgqonUDGOe";
4 $ip = getip();
5 $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
6 $responseKeys = json_decode($response,true);
7 if(intval($responseKeys["success"]) !== 1) {
8 return FALSE;
9 }else{
10 return TRUE;
11 }
12 }