Integrating reCAPTCHA with PHP

reCAPTCHA is a free service by Google that protects your site from spam. In this tutorial, I will walk you through integrating reCAPTCHA in PHP.

Davison Pro
3 min readSep 29, 2019

reCAPTCHA is a free service by Google that protects your site from spam and other types of automated abuse. It uses advanced risk analysis techniques to tell humans and bots apart.

This tutorial is aimed at people who are familiar with basic PHP and HTML forms. The source code of this tutorial is available here.

Sign up for your API keys reCAPTCHA API keys

To start using reCAPTCHA you will need to register your website to get the reCAPTCHA API key pair from Google. The key pair consists of a site key and a secret key. The site key is used to call or invoke the reCAPTCHA service on your site. The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user’s response. The secret key needs to be kept safe for security purposes.

Fill in the form and select the reCAPTCHA v2 and in that select “I am not a robot” checkbox option.

--

--