我刚开始使用Google服务来阻止我的网站中的一些网页垃圾信息,并通过合并Javascript和PHP来响应我的网页来使用AJAX。
在下面的链接中,我阅读了与它相关的所有信息,并执行了步骤,一切都是正确的。
Google代码recaptcha文档
我面临的问题是在验证过程中使用的两个字段recaptcha_challenge_field和recaptcha_response_field
当我在recaptcha_check_answer中调用verify.php函数时,它会给出以下错误:
不正确-卡普查-溶胶
这意味着recaptcha_challenge_field和recaptcha_response_field为空且未定义。
这两个字段和变量应该有我在过程中使用的reCAPTCHA PHP库中的输入,并且应该有getter来拥有它们并传递上述函数。
我搜索了php文件recaptchalib.php,但没有找到它。
我应该添加隐藏类型的新输入元素并用recaptcha_challenge_field和recaptcha_response_field重命名它们以存储recaptcha参数吗?
我想知道我如何才能正确地通过他们,因为我离开了他们,如导游所说,但它没有正常工作。我是否需要为它们定义新的变量,以及如何将它们与实际的recaptcha参数联系起来。
我想问一下是谁实施了recaptcha,并在此之前使用它来告诉我如何解决这个问题,我感谢您的帮助和提前感谢您的回答。
发布于 2011-09-16 03:21:37
在http://code.google.com/apis/recaptcha/docs/php.html提供的客户端代码。
require_once('recaptchalib.php');<br />
$publickey = "your_public_key"; // you got this from the signup page<br />
echo recaptcha_get_html($publickey);
扩展到:
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=your_public_key"></script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=your_public_key" 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>
现在,我要让" noscript“版本工作,只包括noscript标记中的行,而不是标记本身,并完全删除脚本标记及其内容。缺点是,这需要您作为审批过程的一部分手工复制粘贴。
脚本版本显示、刷新、接受输入等,但根据表单目标PHP中的recaptcha_challenge_field recaptcha_response_field CGI变量,print_r($_POST);
仍未设置。
所以,我有一半的解决方案,上面提出的问题。
https://stackoverflow.com/questions/5014974
复制相似问题