How to add captcha in website

In this article, we are going to learn how to add captcha in our websites.

Q. What is a Captcha ?

what is captcha

Ans. Captcha is a script that prevents bots from spamming a form i.e. it validates that the agent is a real Human. Secondly, it act as a training for Google’s Machine learning by Identifying Objects in Images. So, lets get started,

Step 1) Go to https://www.google.com/recaptcha/admin#list.

Step 2) Choose the type of Captcha you want to add.

Step 3) Select the Domain for its usage. For example, indiaedge.in

Step 4) Click Register .

Step 5) Now you will see your site key and secret key .

Step 6) Paste the script tag in the head section of your page

<script src='https://www.google.com/recaptcha/api.js'></script>

step 7) Paste the code where you want to add captcha.

<div class="g-recaptcha" data-sitekey="Your Site Key here"></div>

To check whether Google has verified that user, send a POST request to “https://www.google.com/recaptcha/api/siteverify”  with these parameters:

secret (required)Your Secret Key here
response (required)The value of ‘g-recaptcha-response’.
remoteipThe end user’s ip address.

and you’re Done.

How to add Captcha in wordpress website

Congratulations, You have successfully added captcha in your form.

Please comment your queries in the comment box & stay tuned.

Add a Comment

Your email address will not be published. Required fields are marked *