开发者

How to access Recaptcha Parameters [ recaptcha_challenge_field and recaptcha_response_field ]?

I am new in using the Google Recaptcha Web service to block spamming in some web pages in my web site plus doing that using AJAX by merging Javascript and PHP to response to my web page.

I read all the information related to it in the following link and I carried out the steps a开发者_如何学Gond everything was correct.

Google Code recaptcha Documentation

The problem I faced is the two fields used in the Verification process [recaptcha_challenge_field and recaptcha_response_field]

When I call the recaptcha_check_answer function in verify.php it gives me the following error:-

incorrect-captcha-sol

Which means that [recaptcha_challenge_field and recaptcha_response_field] are null and not defined.

These two fields and variables should have the input in the reCAPTCHA PHP library I used during its process and should have getters to have them and pass in the mentioned function.

I searched the php file recaptchalib.php for that but I did not find it.

Should I add new input elements of hidden type and rename them with recaptcha_challenge_field and recaptcha_response_field to store the recaptcha parameters ?

I wonder how I can pass them in a correct way as I leave them as the guide said but it did not work properly. Did I need to define new variables for them and how to link them with the actual recaptcha parameters.

I would like to ask who implemented recaptcha and used it before to tell me how to solve that and I appreciate your help and Thanks in advance for your answer


The client-side code supplied at 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);

expands to:

<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>

Right now, I'm getting the "noscript" version to work by including only the lines inside the noscript tag; not the tag itself, and deleting the script tag and its contents entirely. Downside is that requires you to do a manual copy-paste as part of the approval process.

The script version is displaying, refreshing, accepting input, etc., but the recaptcha_challenge_field recaptcha_response_field CGI variables remain unset, according to print_r($_POST); in the target PHP of the form.

So I've got half a solution to the problem posed above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜