use google reCAPTCHA on localhost
A CAPTCHA is a program that ensures sites against bots by producing and evaluating tests that people can pass yet current PC programs can’t. For instance, people can read misshaped message as the one demonstrated as follows, however current PC programs can’t. Read More About Captcha on http://www.captcha.net/
If you are here so its simply means that you are familier with captcha and you of course know what is captcha and google reCAPTCHA.But i am writing this post to tell you that you can also use google recaptcha on localhost too.Lets Start
Step 1 : download code
Before we start you have to download google recaptcha integration kit.Either you can download it from google recaptcha website or you can download from here
after downloading it copy it in your localhost folder
Step 2 : login to google
go to google recaptcha and login with your google account.
after loggin in you will redirected to https://www.google.com/recaptcha/admin .It will ask you to register your site.Simply put a Label and put localhost as domains and hit Register button
Step 3 : get Site Key and Secret Key
after registering localhost as a site you will redirected to a new page.here you can see your Site Key and Secret Key just copy them and use it in your recaptcha file.
If you have downloaded it from my given link then replace site key and secret key in examples > example-captcha.php file.
Step 4 : connect files
put below file where you want your captcha appear
<div class="g-recaptcha" data-sitekey="6LcePAATAAAAAGPRWgx90814DTjgt5sXnNbV5WaW"></div>
attach this recaptcha api js file
Step 5 : Run File
after compliting all above steps run you recaptcha file from localhost as http://localhost/recaptcha/examples/example-captcha.php here you can see google reCaptcha.
Step 6 : validating captcha
in your example-captcha.php file you can check if user passed the captcha test or not by checking g-recaptcha-response value
// process form here
echo " you are human ";
echo "oops please verify you are human ";
hope it wil help you to integrate google recaptcha in localhost if you are using it for testing or learning.if you have any questions then let me know in comment section below.subscribe me as well 😀