所以我试图用我的表格重新开始工作。这是我对表单的代码。
<form action="" method="post">
<input type="text" name="text4" id="text4" style="width:400px" /><br/><br/>' . '<script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=XXXXXXXXXXXXXXXXXX">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=XXXXXXXXXXXXXXXXXX"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field"
value="manual_challenge">
</noscript><input type="button" value="Submit"/>
我正在尝试使用不带插件的recaptcha。很容易让它显示,但我很难验证输入。任何人都知道如何在没有插件的情况下进行验证? 非常感谢。
答案 0 :(得分:3)
要使reCaptcha正常工作,您的服务器端代码应该类似于此处发布的内容:
在任何服务器端语言中,如果不使用类似于此的解决方案,就无法使reCaptcha工作。这是代码:
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
}