reCaptcha Not working in PHP

tsarahholmes

New Member
(There is no problem with the code below, it was because i had a custom google.com dns record on my server for testing and reCaptcha uses google servers)I have been trying to implement reCaptcha for ages now, i have tried many of the different tutorials but none of them work for me, what is below is from the guides on their own website. I have PHP, the recaptchalib.php and the keys are right. Don't have a clue how to get this one working. I have also tried having a .html form file then form posts to a send.php but that does not work either.\[code\]<html><body><?phprequire_once('recaptchalib.php');define('PUBLIC_KEY', '6Ldbwb0SAAAAAIaPd2----------------------');define('PRIVATE_KEY', '6Ldbwb0SAAAAAI2ndA----------------------');$error = null; if ($_POST["recaptcha_response_field"]) { $response = recaptcha_check_answer( PRIVATE_KEY, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] ); if ( $response->is_valid ) {$to = "[email protected]";$from = "[email protected]";$subject = "Contact Form: -----.com";$message = "Name: " . $_POST["name"] . "\nEmail: " . $_POST["email"] . "\nMessage:" . "\n\n" . $_POST["message"];$flag = mail($to, $subject, $message, "From: $from");echo "<script>alert('Message Sent!')</script>";echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=/\">"; } else { $error = $response->error; echo "<script>alert('Message Not Sent!')</script>"; } }?><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><p>Your Name:<br><input type="text" name="name" maxlength="100" size="60"></p><p>Your Email:<br><input type="text" name="email" maxlength="100" size="60"></p><p>Message:<br><textarea type="text" name="message" ROWS="18" COLS="65"></TEXTAREA></p><?phpecho recaptcha_get_html($publickey);?><input type="submit" value="http://stackoverflow.com/questions/3901154/submit" /></form></body></html>\[/code\]
 
Back
Top