Google reCAPTCHA Installation. Because you probably hate spam too.

Let’s face it, we all hate spam.

I can’t think of anything more annoying than checking my email just to find that someone had submitted my website form 112 times in less than an hour.

What is reCAPTCHA?

It’s a spambot’s worst nightmare, that’s what it is!  reCAPTCHA is a free service from Google  that protects your website from spam and abuse. reCAPTCHA uses an advanced risk analysis engine and adaptive CAPTCHAs to keep automated software from engaging in abusive activities on your site. It does this while letting your valid users pass through with ease.

reCAPTCHA offers more than just spam protection. Every time our CAPTCHAs are solved, that human effort helps digitize text, annotate images, and build machine learning datasets. This in turn helps preserve books, improve maps, and solve hard AI problems.

So if you’re getting inundated with spam or emails that just seem to not make any sense, than Google
reCAPTCHA is for you!

 

        ADVERTISEMENT                                                                                                            GET A PROFESSIONAL WEBSITE FOR AS LOW AS $499.  Click below to learn more!
web designer in myrtle beach

reCAPTCHA Installation

Installing the “are you a robot” reCAPTCHA involves the following steps:

  1. Goto https://www.google.com/recaptcha and Login
  2. Once logged in, look for “Register a new site“.   Choose “reCAPTCHA V2“.
  3. Enter your domain(s), and then click “Register”
  4. On the next page, you will be provided with:  Site Key and Secret Key, along with 2 snippets that need to be added to your website & form.
  5. There are 2 sides to this – client side (added to your page) and server side (implement).

Example of  client side form :

<html>
  <head>
    <title>Google recapcha demo </title>
    <script src=‘https://www.google.com/recaptcha/api.js’></script>
  </head>
  <body>
    <h1>Google reCAPTHA Demo</h1>
    <form id=“comment_form” action=“form.php” method=“post”>
      <input type=“email” placeholder=“Type your email” size=“40”><br><br>
      <textarea name=“comment” rows=“8” cols=“39”></textarea><br><br>
      <input type=“submit” name=“submit” value=“Post comment”><br><br>
      <div class=“g-recaptcha” data-sitekey=“=== Your site key ===”></div>
    </form>
  </body>
< /html>

Example of  server side :

<?php
$email;$comment;$captcha;
if(isset($_POST[’email’])){
$email=$_POST[’email’];
}if(isset($_POST[‘comment’])){
$email=$_POST[‘comment’];
}if(isset($_POST[‘g-recaptcha-response’])){
$captcha=$_POST[‘g-recaptcha-response’];
}
if(!$captcha){
echo ‘<h2>Please check the the captcha form.</h2>’;
exit;
}
$secretKey = “Put your secret key here”;
$ip = $_SERVER[‘REMOTE_ADDR’];
$response=file_get_contents(“https://www.google.com/recaptcha/api/siteverify?secret=”.$secretKey.“&response=”.$captcha.“&remoteip=”.$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys[“success”]) !== 1) {
echo ‘<h2>You are spammer ! Get the @$%K out</h2>’;
} else {
echo ‘<h2>Thanks for posting comment.</h2>’;
}
?>

*You can view a live version reCAPTCHA form here.

 

 

A Word about Conversion Rates

Always weight the options and balance the need to rid your inbox of annoying emails with the risk of lowering the user-friendliness of contact forms that prospective clients are using to contact you.  Some people get annoyed at captcha “are you a robot” forms, but luckily Google has developed a really functional, comprehensive product, but that doesn’t mean it’s always the best approach to fight spam.

READ THE REST OF THE INSTALLATION GUIDE HERE >>>

Leave a Reply

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