Using reCAPTCHA with Java/JSP - Server returned HTTP response code: 403 for URL

1,611 views
Skip to first unread message

Jeff

unread,
Nov 4, 2011, 9:45:08 AM11/4/11
to reCAPTCHA
Hi,

I have seen a couple of people posting the same problem using the
reCAPTCHA with Java/JSP, but no response from anyone. I'm using the
same example code provided in the Using "reCAPTCHA with Java/JSP "
section to generate and validate the Captcha, but getting the
following error:

Error 500: net.tanesha.recaptcha.ReCaptchaException: Cannot load URL:
Server returned HTTP response code: 403 for URL: http://api-verify.recaptcha.net/verify

I'm testing the captcha using localhost, running under RAD 8.0. The
reCaptcha documentation mentioned localhost should work, so i'm
assuming using http://localhost domain is not the problem here. I
added a break point and found out the exception came from calling the
following method:

ReCaptchaResponse reCaptchaResponse =
reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);

Can someone advise? Any help would be appreciated.

Thanks

Adrian Godong

unread,
Nov 4, 2011, 11:29:14 AM11/4/11
to reca...@googlegroups.com
Update your library, api-verify.recaptcha.net is obsolete.

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

--
Adrian Godong
adrian...@gmail.com

PJH

unread,
Nov 4, 2011, 11:49:18 AM11/4/11
to reca...@googlegroups.com

Jeff

unread,
Nov 4, 2011, 3:49:23 PM11/4/11
to reCAPTCHA
The version I downloaded (recaptcha4j-0.0.7) looks to be the latest,
but the verify url is the old one.
I load the code in my development environment and changed the
HTTPS_SERVER and VERIFY_URL to the following, but still getting the
same exception.

public static final String HTTPS_SERVER = "https://www.google.com/
recaptcha/api";
public static final String VERIFY_URL = "http://www.google.com/
recaptcha/api/verify";

Error 500: net.tanesha.recaptcha.ReCaptchaException: Cannot load URL:
Server returned HTTP response code: 403 for URL: http://www.google.com/recaptcha/api/verify

Any advice?

thanks

Jeff

On Nov 4, 11:49 am, PJH <pauljherr...@gmail.com> wrote:
> On Fri, Nov 4, 2011 at 1:45 PM, Jeff <ho.j...@gmail.com> wrote:
> >http://api-verify.recaptcha.net/verify
>
> http://code.google.com/p/recaptcha/wiki/FAQ?ts=1320421731&updated=FAQ...
>
> --
> PJH

PJH

unread,
Nov 4, 2011, 4:43:52 PM11/4/11
to reca...@googlegroups.com
On Fri, Nov 4, 2011 at 7:49 PM, Jeff <ho....@gmail.com> wrote:
> Error 500: net.tanesha.recaptcha.ReCaptchaException: Cannot load URL:
> Server returned HTTP response code: 403 for URL: http://www.google.com/recaptcha/api/verify

Going to that URL in a normal browser gives me the expected 200 page
telling me it wasn't given the correct data.

I suspect a problem with the server your code is running on blocking
outbound http(s) requests?


--
PJH

Luc Bourdil

unread,
Nov 5, 2011, 4:02:09 AM11/5/11
to reCAPTCHA

Hi,

In my case, the problem is when the API call getInputStream().

The only authorized URL on my server are :
- http://api-verify.recaptcha.net/verify
- http://www.google.com/recaptcha/api/verify

When calling the API, after a while, it's an other IP adress who
answer (exemple tx-in-f147.1e100.net) and it's blocked by our
firewall !!!

So, If I don't restrict HTTP on my server, it's working each time.

BUT, in my case, I have to restrict HTTP access on my server, so I can
open only URL to URL verify...

See you

On 5 nov, 07:43, PJH <pauljherr...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages