How to Integrate Google reCAPTCHA into website forms to avoid spam

If you created contact us form or any other form in your website, there are higher chance the online autobots filling this forms and creating spams into your inbox, to avoid this google has developed “reCAPTCHA” which allows the visitor on the form to confirm that he is a human and not robot.

For this first thing, we will need is to get keys from google website, as

1. Visit “Google Recaptcha Admin” this will require you to login to your gmail account.

2. After login you will get a form like below, for online websites select “reCAPTCHA V2”, give identifiable Label such as your domain name without extention.

3. Enter the website domain name in “domain list, you will not need to add any sub-domains.
4. Tick for selecting “Terms” and click “Register”

Related :   How to resolve : "Undefined variable: crumb" error with openclassifieds

On next opened page, you will get SiteKey & Secret Key.

google recaptch

The next step is to use those keys for the client and server side integration. Google Already has given a example for how to do this. Its better we will reuse those.

Download the files from Github

Or like,

sudo wget -c https://raw.githubusercontent.com/google/recaptcha/1.0.0/php/recaptchalib.php 
sudo wget -c https://raw.githubusercontent.com/google/recaptcha/1.0.0/php/example-captcha.php

Modify Add the above keys into example-captcha.php , Now by referring to this example-captcha.php file, we will need to modify our contact-us.php.

And then upload both recaptchalib.php and our updated contact-us.php to your server.

Reference –
https://codeforgeek.com/2014/12/google-recaptcha-tutorial/


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


Leave a Comment

Android Android Build system Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded