Hello friends ajj me apko btaunga ki ki parkar ham apni website me kisi be form me google invisible recaptcha verification code integrate kar sakte hai easily.
Yanha ham php and mysql ka use be karege takki user dwara enter kiye gye data ,information ,name ,email, message ko ham mysql databse me store karwa sake ,iske liye aap database bana lijiye janha ek google name se table bna lijiye jisme app 4 fields id ,name,email,message create kar lijiye.
Step1-
https://www.google.com/recaptcha/admin
Url open kijiye
step2- ab aap sabse pehle label me apni website ka url enter kijiye jis website me aap google invisible recaptcha verification add karna chahte ho
step3-ab aap recaptcha invisible par click kijiye
step4-domains me apne website ka name enter kijiye jese label me kiya tha
step5-Accept the reCAPTCHA Terms of Service. Ke samne checkbox ko tik kar lijiye(select)
step6-ab register par click kijiye
step6-ab yanha apko site key and secret key milegi aap in key ko yanha se copy kar lijiye or niche diye gye code me paste kar dijiye.
Google Recaptcha Contact Form-index.php
<center>
<?php
$secret_key = '6Le_cF8UAAAAABn1WVwSo_hNWHWAfmyICYKgzG6s';
if (isset($_POST['g-recaptcha-response'])) {
$verifyCaptchaResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret_key.'&response='.$_POST['g-recaptcha-response']);
$responseCaptchaData = json_decode($verifyCaptchaResponse);
if($responseCaptchaData->success) {
echo 'Contact Form Submitted Succesfully';
$conn=mysqli_connect("localhost","id2863877_sonu","password","id2863877_sonu");
//enter your database detail Here
$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$sql = "INSERT INTO google(name, email, message)
VALUES ('$name', '$email', '$message')";
mysqli_query($conn, $sql);
} else {
echo 'Verification failed Try Again';
}
}
?>
<fieldset>
<form method="post" id="Form1" action="">
<h1>Google Invisible Recaptcha</h1>
<input type="text" class="form-control" name="name" placeholder="Enter full name" required/><br>
<input type="email" name="email" placeholder="Your email address" required><br>
<textarea name="message" placeholder="Type your message here...." required></textarea><br>
<button class="g-recaptcha btn btn-primary" data-sitekey="6Le_cF8UAAAAAA54y4FuqqxoVjTm8NMFrIpiOxYP" data-callback="submit">Submit</button>
</form>
</fieldset>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script>
function submit() {
document.getElementById('Form1').submit();
}
</script>
</center>
Thank You
Team Gajabwap Web In Hindi
2 comments
Click here for commentsbro thanks is article ke Liye ye mere liye bhut helpful raha thanks again bro
Replythans bro for comment
ReplyConversionConversion EmoticonEmoticon