How to Integrate Google reCAPTCHA

In this post, I would like to show you how to integrate Google reCAPTCHA. Google reCAPTCHA is more user-friendly and reliable which protects your websites form spams and robots.

What is reCAPTCHA?

If Google feels that you are not human, it will give the second prompt and it will ask you to fill the captcha. Once you verify that it lets you access the resource.

How to integrate?

Integrate Google reCAPTCHA you need followings.

  • A Gmail account. If not, please create it for you.
  • Basic Knowledge of HTML, JavaScript and also PHP

Below are the simple steps to integrate reCAPTCHA…

Step 1:
Get the API key by visit this link https://www.google.com/recaptcha/admin
google recaptcha app registration

google_recaptcha_grab_keys

Client-side Integration: Step 2:
Underneath these keys, there are some scripts that will be added to the client side. You can also define the language for reCaptcha.English is default language. Add the script line at footer or just below the form.

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

Paste this snippet at the end of the

where you want the reCAPTCHA widget to appear:

Here – The data-sitekey is key of your own site-key which is generated by Google for you.

Step 4:

To ensure that reCAPTCHA is working properly, we will run some server-side checks. Save this file as contact.php (If you want to use different name dont fogot to update form action).

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status