Tweet, Share & Like [ EnAcCiOn ]

 

FeedBurner FeedCount Y Facebook | EnAcCiOn

Send Voicemail | EnAcCiOn

Contact me using vCita | EnAcCiOn

Contact me using vCita | EnAcCiOn

Meeting Scheduler Powered by vCita

miércoles, 31 de diciembre de 2014

Code sample to test noCaptcha with Perl cgi

The following code passes the three parameters to google's siteveryify (response, secret, remoteip).It returns one of three conditions.1 = Successful connect to google / input invalid (NOT verified).2 = Successful connect to google / input valid (verified).3 = Unsuccessful connect to google.You need to make 4 changes to this code.Line 5 = Enter your secret keyLine 13 = Desired code for return condition 1.Line 16 = Desired code for return condition 2.Line 20 = Desired code for return condition 3.DISCLAIMER:I am by no means a professional Perl programmer and there may well be a lot better ways to accomplish this task.Feedback or suggestions on how to improve this code are welcome.You are free to use this code as you desire.By using this code you acknowledge that you have fully tested it for your application and you accept full responsibility for any results that you might have with it.sub check_captcha {use LWP::UserAgent;$capurl = 'http://bit.ly/11H4Jer';$capres = $Form{'g-recaptcha-response'};$capsec = 'YOUR SECRET KEY GOES HERE';$capadr = $ENV{'REMOTE_ADDR'};my $ua = LWP::UserAgent->new();my $response = $ua->post($capurl, ['response' => $capres, 'secret' => $capsec, 'remoteip' => $capadr ]);if ($response->is_success) {$capcnt = $response->decoded_content;$capnum = index($capcnt, 'true');if ($capnum == -1) {CONDITION 1 CODE HEREreturn;} else {CONDITION 2 CODE HEREreturn;}} else {CONDITION 3 CODE HEREreturn;}} -- You received this message because you are subscribed to the Google Groups "reCAPTCHA" group. To unsubscribe from this group and stop receiving emails from it, send an email to recaptcha+unsubscribe@googlegroups.com. To post to this group, send email to recaptcha@googlegroups.com. Visit this group at http://bit.ly/1dkFnYd. For more options, visit http://bit.ly/P65DvS.

No hay comentarios:

EnAcCiOn

Contador Web | EnAcCiOn

EnAcCiOn

EnAcCiOn

EnAcCiOn

Blog Archive | EnAcCiOn