In this article i am going to explain how to add Google reCAPTCHA in website.
Please find the below steps:
Step 1 : Go to this website
Step 2: Click Get reCAPTCHA button
Step 3: Click sign up now button
Step 4: Login with your Google Account
Step 5: Enter your domain name and click create button.
Step 6 :Get your public and Private keys,
Step 7: Download library files form this link
Step 8 : Sample PHP form with library file.
Step 9: Enter your keys and library files in the form.Now check.
Please share your comments and feedback.Thanks.
Please find the below steps:
Step 1 : Go to this website
Step 2: Click Get reCAPTCHA button
Step 3: Click sign up now button
Step 4: Login with your Google Account
Step 5: Enter your domain name and click create button.
Step 6 :Get your public and Private keys,
Step 7: Download library files form this link
Step 8 : Sample PHP form with library file.
Sample Form
<form action="" method="post">
<?php
require_once('recaptchalib.php');
// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "";
$privatekey = "";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
<br/>
<input type="submit" value="submit" />
</form>
<?php
require_once('recaptchalib.php');
// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "";
$privatekey = "";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
<br/>
<input type="submit" value="submit" />
</form>
Step 9: Enter your keys and library files in the form.Now check.
Please share your comments and feedback.Thanks.
No comments:
Post a Comment