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”

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 
 sudo wget -c 

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 –

Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question