Last active
March 27, 2021 18:21
-
-
Save saltun/23dfc53ddab9994f14e171567b73ef9e to your computer and use it in GitHub Desktop.
PHP Google reCaptcha Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_POST) { | |
/* | |
* Author : Savaş Can ALTUN <[email protected]> | |
* Date : 28.06.2016 | |
* Personel Page => http://savascanaltun.com.tr | |
* Video Example => https://www.youtube.com/watch?v=7F-vWQjbeMo | |
*/ | |
$url="https://www.google.com/recaptcha/api/siteverify"; | |
$r=$_POST['g-recaptcha-response']; | |
$k="SCRET_KEY"; | |
$ip=$_SERVER['REMOTE_ADDR']; | |
$gidicek_adress=$url."?secret=".$k."&response=".$r."&remoteip=".$ip; | |
$res=file_get_contents($gidicek_adress); | |
$res=json_decode($res,true); | |
if ($res['success']) { | |
echo "Bot değil doğrulama başarılı"; | |
}else{ | |
echo "Bot tespit edildi."; | |
} | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Test Sayfası </title> | |
<script src='https://www.google.com/recaptcha/api.js'></script> | |
</head> | |
<body> | |
<form action="" method="POST"> | |
<input type="text" placeholder="Test"> | |
<div class="g-recaptcha" data-sitekey="SITE_KEY"></div> | |
<button>Gönder</button> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment