form.php
<html> <body> <form method="post" action="verify.php"> <?php require_once('recaptchalib.php'); $publickey = "6LecdRYUAAAAAD3W0PGhRENtLV6qNHlvwCekxTZB"; // Public Key echo recaptcha_get_html($publickey); ?> <input type="submit" /> </form> </body> </html>
verify.php
<?php require_once('recaptchalib.php'); $privatekey = "6LecdRYUAAAAAB9onGAL2HDhVadT2T_CQKHlOOB-"; // Private Key $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly //die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . // "(reCAPTCHA said: " . $resp->error . ")"); echo "<font color='red'>Captcha Invalid code</font>"; } else { echo "<font color='green'>Congratulations</font>"; } ?>