7 Replies Latest reply on Apr 7, 2010 8:28 AM by WRobN1

    reCAPTCHA wont work...

    WRobN1 Level 1

      I asked this on the reCAPTCHA forum as well.

       

      But because of the many people here i see more chance that i get my awnser here. (reCAPTCHA forum is a bit slow)

       

      I did a simple test to look if reCAPTCHA works.
      These following 2 PHP files; "form" and "verify" should work but dont.
      The reCap img shows but the verification goes wrong.
      It always result in this text:

      The reCAPTCHA wasn't entered correctly. Go back and try it again.
      (reCAPTCHA said: )

       

      This is my php test form (only recaptcha);

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// 
      www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
      <html xmlns="http://www.w3.org/1999/xhtml"> 
      <head> 
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
      <title>Untitled Document</title> 
      </head> 
      <body> 
      <form method="post" action="verify.php"> 
         <?php 
           require_once('recaptchalib.php'); 
           $publickey = "xXxXxXxXxXxXxXxXx"; 
           echo recaptcha_get_html($publickey); 
         ?> 
      </form> 
      </body> 
      </html>
      

      _____________________________________________

       

      And this the verify.php :

       

       <?php 
       require_once('recaptchalib.php'); 
       $privatekey = "xXxXxXxXxXxXxXxXx"; 
       $response = 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 . ")"); 
       } 
       ?> 
      
      

       

      _____________________________________________

       

      The problem are the 2 php files above. They wont work and i dont know

      why.
      Its the basic code from the reCAP site.

      It should work but it doesnt.

      HELP!

       

       

      (I need to keep those 2 files seperated. An example from reCAPTCHA wich came with the library file works, but has both functions in the same file. And its different from the code i got from the recap site. The weirdest thing is that im not the only one using this code but probably one of the few who dont get it working.)