Today we are going to tell you how you can setup recaptcha code to make your website secure, today we are going to tell you about Google Invisible recaptcha code, in which what happens, it contains recaptcha code but that no one can see,

How does invisible reCAPTCHA work

When you apply Google Invisible reCAPTCHA for the purpose of security in any of your website, then the security level of your website becomes very good, by applying this your website cannot be accessed by coding, bypass update data on your server Why should Google Invisible reCAPTCHA apply captcha, there is also an advantage that I am not a robot captcha, your aim is only to protect the website from being hacked, not the logo To tell about the security, in such a situation, you can put Invisible reCAPTCHA, this captcha is on your website but no one can see it, in which the captcha has to be manually verified, in Visible Recaptcha, the captcha gets auto verified in this, This gives a lot of money to the visitor, so we should apply invisible captcha only.

How to setup hide/Invisible recaptcha in website php

For this, follow some steps given below, you can easily install this Invisible reCAPTCHA in any of your website.

How to generate invisible recaptcha keys

First of all, on the website on which you want to apply this Invisible reCAPTCHA, you have to generate two first Site Key, second Secret Key, after that you have to go to your website and implement both the keys.

Click on https://www.google.com/recaptcha/admin/create to generate Secret key and Site Key.

Enter your website’s domain name in Label, then reCAPTCHA v2 Select it, click on Invisible reCAPTCHA badge, enter your website name in Domains without https /

You will be shown a mail address in Owners, if you want to make it the owner, then you can add a new mail below, accept the reCAPTCHA Terms of Service, then click on the submit button.

Then you will get to see like this in front of you, in this you get to see both SITEY KEY and SECRET KEY.

How to implement invisible recaptcha

Open the website on which you want to put the invisible recaptcha and the page on which it is in the notepad.

You have to paste the following script inside the <head></head> tag in the page of the website where you are putting the invisible recaptcha

For api script Implement <head></head>

<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script
		src="https://www.google.com/recaptcha/api.js?onload=onloadCallback"
		async defer></script>
	<script
		src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
	<script>
var onloadCallback = function() {
    grecaptcha.execute();
};

function setResponse(response) { 
    document.getElementById('captcha-response').value = response; 
}</script>

The above mentioned java script has to be added to the head section.

For SITE Key Implement <body></body>

You have to copy the code given below and add the site key generated by your website in it, then you have to put this code in the page of your website a little above the submit button in the Form Tag.

 <div style="display:block;" class="g-recaptcha"
				data-sitekey="yourwebsitesitekeypaste"
				data-badge="inline" data-size="invisible"
				data-callback="setResponse"></div>
			<input type="hidden" id="captcha-response" name="captcha-response" />

Then you will get to see Protected by reCAPTCHA message in that page if you want to turn it off then you have to block to none style=”display:none;” Enter this code will not be visible to the visitor but will be on the website

 

For Secret Key Implement

You have put your Google Invisible reCAPTCHA code on your website because of the data being shown on your website or other information, which you want to protect from theft so that no one can put it on your website

<?php
$secretKey = "enter your secret key";
$responseKey = $_POST['g-recaptcha-response'];
$UserIP = $_POST['REOMTE_ADDR'];
$url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$responseKey&remoteip=$UserIP";

$response = file_get_contents($url);
$response = json_decode($response);


if (isset($_POST['submit']) && $response->success)  
     {
      <!---Here you enter the code which you want to show only if the captcha is verified--->
}?>

Enter the above code before starting the HTML TAG in the page, in “Here you enter the code which you want to show only if the captcha is verified” enter the code when someone submits the form and verify the captcha code Once this script is done, please update your secret above.

 

If you understand the code given by me as I have told you and enter it in your website without mistake, then Google Invisible reCAPTCHA script will start working successfully on your website.

 

Leave a Reply

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