2012-01-14 6 views
3

ReCaptcha를 설치하고 공개 키와 개인 키를 구성 했으므로 아무 답이든간에 입력 할 때까지 아무 문제가 없습니다. 좋든 나쁘 든간에 발생한 오류로 응답하십시오. 양식 요청이이 파일이ReCaptcha는 항상 오류없이 false를 반환합니다.

<html> 
<body> <!-- the body tag is required or the CAPTCHA may not show on some browsers --> 
    <!-- your HTML content --> 

    <form method="post" action="verify.php"> 
    <?php 
     require_once('recaptchalib.php'); 
     $publickey = "your_public_key"; // you got this from the signup page 
     echo recaptcha_get_html($publickey); 
    ?> 
    <input type="submit" /> 
    </form> 

    <!-- more of your HTML content --> 
</body> 
</html> 

입니다 어디로 : config 파일에서 개인 키를 & 당신은 양식 파일에 공개 키가 필요

require_once('recaptchalib.php'); 
$resp = recaptcha_check_answer ($config->privkey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); 

if (!$resp->is_valid) { 
    echo $resp->error; 
} 

답변

5

... : 당신의 rechaptchalib.php 변화에

:

define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net"); 
define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net"); 
define("RECAPTCHA_VERIFY_SERVER", gethostbyname('api-verify.recaptcha.net')); 

하려면 :

define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api"); 
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api"); 
define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); 

아마도 오래된 PHP 라이브러리, 당신은 또한 최신 라이브러리를 다운로드하는 것이 더 나을 것이다 있도록 :

http://code.google.com/p/recaptcha/downloads/list?q=label:phplib-Latest

감사 모두를.

+0

예. 버전 1.11에는 확실히 새로운 URL이 있습니다. –

+0

확인 ** recaptcha_check_answer (...) **는 항상 ** http **를 통해 이루어지며 ** https **는 절대로 사용되지 않습니다. 공개 키가 암호화되어 전송 된 경우에도 개인 키는 일반 텍스트로 전송됩니다. 자신이 선택한 이상한 선택. –

0

: 여기

내 코드입니다

<?php 
    require_once('recaptchalib.php'); 
    $privatekey = "your_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 . ")"); 
    } else { 
    // Your code here to handle a successful verification 
    } 
    ?> 

더 많은 도움이 필요하시면 http://code.google.com/apis/recaptcha/docs/php.html로 가십시오.

다음

누군가가 비슷한 문제가 있는지 솔루션입니다 I이 검색의 일 후에 답을 발견했습니다
+0

설정 또는 양식 파일에 공개 키를 가지고 있더라도 상관 없습니다 ... 귀하의 대답은 불행히도 도움이되지 않습니다. – Cyclone

관련 문제