How to integrate google reCAPTCHA in PHP

How to integrate google reCAPTCHA in PHP

Googl reCAPTCHA is used to validate form submit in php.It is easy to integrate Google reCAPTCHA in PHP script. Using google reCAPTCHA in PHP users can prove they are human with single click.

They need just a single click to confirm they are not a robot. So, reCAPTCHA used to protect the website from spammers.

Follow the below steps to integrate google reCAPTCHA in PHP

how-to-integrate-google-recaptcha-in-php

Get reCAPTCHA API keys:

For adding reCAPTCHA to your site, you need to register your site and get reCAPTCHA API keys

Register your site:

Register your site at Google from here – https://www.google.com/recaptcha/admin

google-recaptcha-register-new-site-by-getsourcecodes

Get your Site Key:

Site key is used to display the google reCAPTCHA widget.

integrate-google-reCAPTCHA-with-PHP-site-key

Get your Secret Key:
Secret key helps authorizes communication between your website and google reCAPTCHA server.

google-recaptcha-secret-key-by-getsourcecodes

HTML Code:
At first you need to include the google reCAPTCHA API JavaScript library.

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

Before the Submit button we have placed the Google reCAPTCHA widget div. Modify the data-sitekey attribute value with your Site Key.

PHP Code:
Need to modify Google Secret Key for ($secret).