Want to use Google reCaptcha on your website? Here is how you can do so…

In this post I am going to describe the steps you can apply in order to install and configure google captcha on your website.

Source: https://www.google.com/recaptcha/intro/index.html

INSTALL AND CONFIGURE GOOGLE RECAPTCHA

1. You need to have a google account in order to use google recaptcha.
Click here to create an account now.

2. After you’re done with registering your google account or login in to google account if you already have one. Now, the next step is to visit the following url : https://www.google.com/recaptcha/admin

3. On the webpage https://www.google.com/recaptcha/admin, you will be registering your website. Please see the below image for clarification:

register_website_for_key

You will need to enter a title and domain name and click on register button to proceed.

4. As soon as all details are validated in step 3, you will get the “site” key for client end and “secret” key server level integration.

secret_client_key


HOW IT WORKS?

STEP-1: Client Side Integration

a. Paste this snippet before the closing tag on your HTML template:

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

b. Paste this snippet at the end of the

where you want the reCAPTCHA widget to appear:

<div class="g-recaptcha" data-sitekey="XXXXXXXXXXX"></div>

Detailed description can be found here : https://developers.google.com/recaptcha/

Step-2: Server Side Integration

When your users submit the form where you integrated reCAPTCHA, you’ll get as part of the payload a string with the name “g-recaptcha-response”. In order to check whether Google has verified that user, send a POST request with these parameters:

URL: https://www.google.com/recaptcha/api/siteverify

a. secret (required)
b. response (required)
c. remoteip

Detailed description can be found here : https://developers.google.com/recaptcha/docs/verify

PHP Example Source Code: https://github.com/google/recaptcha

Hope this example serves you need!

Advertisements

Yuvraj has written 39 articles

"Learn & Share" - I believe in this. What about you?