reCAPTCHA is one way to secure the Form on the pages of your website so that can not be processed by the Bot or also called the robot, in other words, this reCAPTCHA serves to prove that the Form is in the manual content by humans. on this occasion I will share tutorials on how to implement or how to make Google reCAPTCHA on your website with PHP.
<?php
if(isset($_POST['submit'])){
$email = $_POST['email'];
$captcha = $_POST['g-recaptcha-response'];
$secretKey = "6Lf7WCUTAAAAAGJzZ-U_aPv5GiGLEOExXDFpI_PM";
$ip = $_SERVER['REMOTE_ADDR'];
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
echo 'Helloo... Spam detected... :(
';
}else{
echo 'Oke! you are real human... :)
';
}
}
?>
$email = $_POST['email'];
$captcha = $_POST['g-recaptcha-response'];
if(intval($responseKeys["success"]) !== 1) {
echo 'Helloo... Spam detected... :(
';
}else{echo 'Oke! Anda benar-benar Manusia biasa... :)
';
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TUTORIALWEB.NET | reCAPTCHA</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style>
.g-recaptcha {
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-6">
<h3>Daftar</h3>
<hr>
<form action="daftar.php" method="post" autocomplete="off">
<div class="form-group">
<label for="email">Email</label>
<input type="email" name="email" class="form-control" id="email" placeholder="[email protected]" required>
</div>
<div class="g-recaptcha" data-sitekey="6Lf7WCUTAAAAANJ2ZMQ1Xvum9wXMo_6tGcl_rYej"></div>
<input type="submit" name="submit" value="Daftar" class="btn btn-primary">
</form>
</div>
</div>
</div>
<script src='https://www.google.com/recaptcha/api.js'></script>
</body>
</html>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
and this is the section for to display its reCAPTCHA. In the script below enter the blue box.
<div class="g-recaptcha" data-sitekey="6Lf7WCUTAAAAANJ2ZMQ1Xvum9wXMo_6tGcl_rYej"></div>
<script src='https://www.google.com/recaptcha/api.js'></script>
SORRY WHETHER THERE IS LACK AND SENSE