Gossamer Forum
Home : Products : Others : Gossamer Community :

captcha, I am not a robot

Quote Reply
captcha, I am not a robot
I am trying to use Google's "I am not a robot" captcha. Apparently they acquired recaptcha, and changed it.

I want to use it on my community user signup page. Adding the code to the user signup template is easy, and it works fine.

The verify part is causing the problem. Google's instructions are found here:
https://developers.google.com/recaptcha/docs/verify


I tried to include the appropriate code as part of
sub user_signup
in
/cgi-bin/community/private/lib/Community/Web/user.pm


the XXXXXXXXXX represents the code assigned to me by Google for the captcha.

Code:
my $URL = 'https://www.google.com/recaptcha/api/siteverify?secret=XXXXXXXXXX&response=g-recaptcha-response';
my $contents = get $URL or die;
# Split contents variable by comma
my ($success, $challenge_time, $hostname) = split /,/, $contents;
# Split success variable by colon
my ($success_title, $success_value) = split /:/, $success;
#strip whitespace:
$success_value =~ s/^\s+//;
if ($success_value eq "true")
{
print "it worked";
}else{
print "it did not";
}


I get this error message
Code:
Can't locate object method "get" via package "https://www.google.com/recaptcha/api/siteverify?secret=XXXXXXXXXXXX&response=g-recaptcha-response" (perhaps you forgot to load "https://www.google.com/recaptcha/api/siteverify?secret=XXXXXXXX&response=g-recaptcha-response"?) at /var/home/cyberinstitute/cyberinstitute.org/cgi-bin/community/private/lib/Community/Web/User.pm line 439.
Thanks for your help!
Quote Reply
Re: [tora] captcha, I am not a robot In reply to
Hi,

You probably are not including LWP::Simple?

Code:
use LWP::Simple

Personally though, I use this module to do it:

http://search.cpan.org/...tcha/reCAPTCHA/V2.pm

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!