我的問題與我的recaptcha。問題是它總是返回false,意味着它說驗證碼失敗。即使輸入了正確的單詞。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轉儲後...
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" }
變種轉儲請求......
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" }
檢查你確實在'$ _POST'中獲得了'recaptcha_response_field'的值嗎? – GBD
對不起?不太明白這一點。從我得到的。表單和這個變量都是POST。 – lecardo
你var_dump($ _ POST)的結果是什麼;和var_dump($ _ REQUEST); ? –