recaptcha总是返回false

时间:2012-11-23 17:25:13

标签: php recaptcha

我的recaptcha有问题。问题是它总是返回false意味着它表示验证码失败了。即使输入了正确的单词。

一切都是最新的,使用最新的库并三重检查代码和公钥/私钥。

问题我相信在这里......

require_once('recaptchalib.php');
          $privatekey = "************************************";
    $resp = recaptcha_check_answer ($privatekey,
                                    $_SERVER["REMOTE_ADDR"],
                                    $_POST["recaptcha_challenge_field"],
                                    $_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
                  $error_string .= '<center>The reCAPTCHA wasnt entered correctly. Go back and try it again.</center><br />';
        }

我按照这个例子,所以我看不出有什么问题。已经好几天了!

https://developers.google.com/recaptcha/docs/php

客户代码:

require_once('recaptchalib.php');
    $publickey = "**********************"; // you got this from the signup page
    echo recaptcha_get_html($publickey);

在$ resp变量上执行了var转储并得到了这个

object(ReCaptchaResponse)#2 (2) { ["is_valid"]=> bool(false) ["error"]=> string(21) "incorrect-captcha-sol" }

还做了一个var_dump recaptcha响应字段,得到了:

NULL

var dump post ...

array(7) { ["user"]=> string(0) "" ["pass1"]=> string(0) "" ["pass2"]=> string(0) "" ["email"]=> string(0) "" ["email2"]=> string(0) "" ["gender"]=> string(4) "Male" ["register"]=> string(8) "register" }

var转储请求...

array(10) { ["user"]=> string(0) "" ["pass1"]=> string(0) "" ["pass2"]=> string(0) "" ["email"]=> string(0) "" ["email2"]=> string(0) "" ["gender"]=> string(4) "Male" ["register"]=> string(8) "register" ["PHPSESSID"]=> string(26) "4e79u2fdgrrufvb79einufcmq6" ["cprelogin"]=> string(2) "no" ["cpsession"]=> string(65) ":fX5Z1aWfbsgjGfgb3b3J7koo3Y58y5ntgM6k8GTdrQ4YAcqaywAKnD7PRiayfXv3" }

1 个答案:

答案 0 :(得分:1)

感谢您的支持。我发现这个问题决定发布,如果有人在将来遇到这个问题。

我的表格在我的表格内,如

<table><form>...</form></table>

显然表格应先是表格!

相关问题