PHP and Google reCaptcha Implementation via cURL

, , ,

So the first step is to add the recaptcha api call to before the close head tag.

Then within the form itself before the submit button or where ever you would like the reCaptcha Checkbox to show.

The because I use PHP I found the best way to do the checking within the form processing is to use curl.

In the above example GOOGLE_SITE_KEY and GOOGLE_SECRET_KEY need to be replaced for the keys for your domain.  At the bottom where it is checking if the success is false is where I am saying there was an error and also setting the captcha error message that will be displayed.

Submit a Comment

Your email address will not be published. Required fields are marked *