PHP Plug-in for CAPTCHA not working

523 views
Skip to first unread message

robbiecordo

unread,
Aug 4, 2010, 4:40:48 PM8/4/10
to reCAPTCHA, rco...@eurocarsus.com, sa...@mm.com
Just today I started to use the PHP plug-in but I can't get it to
work. The problem is the "recaptcha_response_field" and
"recaptcha_challenge_field" input elements are not being generated
within the input form, so the server side does not see them. Also I am
getting no error message when making the
recaptcha_get_html($publickey, $error) call. And when I make the form
call using the CAPTCHA verify url the error message is - false
'Input error: response: Required field must not be blank\nchallenge:
Required field must not be blank\nprivatekey: Required field must not
be blank\n'

I am using the standard code -
require_once('../includes/recaptchalib.php');
echo recaptcha_get_html($publickey['eurocarsus.com'], $error);
echo "\$error = $error" . "<br>\n";

The script code found in the source on the page is -

<tr><td colspan="6" align="center"><script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?
k=6LetDbwSAAAAAOv-03wMFYzQkf1YYQZV-VtZscqD"></script>

<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?
k=6LetDbwSAAAAAOv-03wMFYzQkf1YYQZV-VtZscqD" 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>$error = <br>
</td></tr>

Can anyone help?

Thanks


robbiecordo

unread,
Aug 4, 2010, 5:14:16 PM8/4/10
to reCAPTCHA
Here's some more info. Using FireBug it shows this error message -
Failed to load source for:
http://www.google.com/recaptcha/api/challenge?k=6LesDbwSAAAAAOK9XMOIgdXRwOK2BkejbP1Pg2oB
under the http://www.google.com/recaptcha/api/challenge?k=6LesDbwSAAAAAOK9XMOIgdXRwOK2BkejbP1Pg2oB
call

Is the CAPTCHA Server down?

reCAPTCHA Support

unread,
Aug 4, 2010, 9:17:49 PM8/4/10
to reca...@googlegroups.com

Loading the challenge URL works for me. Check if it's firewalled for you, or otherwise blocked?

Colin

> --
> You received this message because you are subscribed to the Google Groups "reCAPTCHA" group.
> To post to this group, send email to reca...@googlegroups.com.
> To unsubscribe from this group, send email to recaptcha+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/recaptcha?hl=en.
>

Drew

unread,
Aug 6, 2010, 5:11:25 AM8/6/10
to reCAPTCHA
Not sure if it is relevant but my code straight from the php example
does not work in Firefox. Keep getting error captcha sol. Have you
tested yours in a different browser?

If I use IE or any other browser it works 100%. Anyone got any ideas
obviously a captcha that does not work in a particular browser is
pretty useless.



On Aug 5, 3:17 am, reCAPTCHA Support <supp...@recaptcha.net> wrote:
> Loading the challenge URL works for me. Check if it's firewalled for you, or
> otherwise blocked?
>
> Colin
>
> On Aug 4, 2010 5:14 PM, "robbiecordo" <rco...@usa.net> wrote:> Here's some more info. Using FireBug it shows this error message -
> > Failed to load source for:
>
> http://www.google.com/recaptcha/api/challenge?k=6LesDbwSAAAAAOK9XMOIg...> under the
>
> http://www.google.com/recaptcha/api/challenge?k=6LesDbwSAAAAAOK9XMOIg...
> recaptcha+...@googlegroups.com<recaptcha%2Bunsu...@googlegroups.com>
> .> For more options, visit this group at
>
> http://groups.google.com/group/recaptcha?hl=en.
>
>
Message has been deleted

P JH

unread,
Aug 6, 2010, 8:53:44 AM8/6/10
to reca...@googlegroups.com
On Fri, Aug 6, 2010 at 1:49 PM, breusshe <breu...@hotmail.com> wrote:
> passtest.html:

Shouldn't that be passtest.php?

--
PJH

http://www.ipetitions.com/petition/makeitthemaximum

Drew

unread,
Aug 6, 2010, 9:33:48 AM8/6/10
to reCAPTCHA
any ideas why mine would work in IE and not firefox? I have everything
as per demo php page. all my pages are php etc. the page works 100% in
IE but in Firefox I get

The reCAPTCHA wasn't entered correctly. Go back and try it again.
(reCAPTCHA said: incorrect-captcha-sol)

It does not matter what I do...

P JH

unread,
Aug 6, 2010, 9:48:58 AM8/6/10
to reca...@googlegroups.com
On Fri, Aug 6, 2010 at 2:33 PM, Drew <urchin...@gmail.com> wrote:
> any ideas why mine would work in IE and not firefox?

Nope.

What messages does the Error Console give? What about the W3C
validators for HTML and CSS?

--
PJH

http://www.ipetitions.com/petition/makeitthemaximum

breusshe

unread,
Aug 6, 2010, 10:06:14 AM8/6/10
to reCAPTCHA
Yes, PJH. I just figured that out. I thought it would be an HTML
file since the PHP was embedded within HTML code in the examples.
However, I altered my code to the following:

passtest.php:

<?php
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<body>
<form method='post' action='verify.php'>\n ";
require_once('recaptchalib.php');
$publickey = '<my valid public key>'; // you got this from the
signup page
echo recaptcha_get_html($publickey);
echo "\n <input type='submit' />
</form>
</body>
</html>";
?>

========================================================

The above alterations to the example code from the PHP plugin page got
my page to start working. The '\n ' added to the "<input
type=submit" portion just makes my output HTML look clean, doesn't
affect functionality.

Thanks for the response!

@Drew, try the code I'm listing in this post, see if that works. I'm
using it in Firefox, Chrome and IE on Linux and WinXP and the code in
this post works fine in any browser for both OS's.

P JH

unread,
Aug 6, 2010, 10:11:55 AM8/6/10
to reca...@googlegroups.com
On Fri, Aug 6, 2010 at 3:06 PM, breusshe <breu...@hotmail.com> wrote:
> I thought it would be an HTML
> file since the PHP was embedded within HTML code in the examples.

But it has PHP in it, thus it needs to go through the PHP parser. the
.php suffix on the file indicates to the webserver that that's what
needs to happen.

>However, I altered my code to the following:

Unnecessary. Anything not in <?php ... ?> is passed straight through
the parser as-is.

Your original file, just renamed, is totally valid PHP. You've simply
made the code harder to read ;)

--
PJH

http://www.ipetitions.com/petition/makeitthemaximum

Reply all
Reply to author
Forward
0 new messages