lazybowel has asked for the wisdom of the Perl Monks concerning the following question:
What im trying to figure out is how can i get the script to wait for the input and then continue with the rest of the forms.my $page = $mech->content; if ($page =~ /Please enter/) { #print $mech->content; my $captchaimage = $mech->find_image( url_regex => qr/site.com\/captch +a/i ); $captchaimage = $captchaimage->url; print "Content-type: text/html\n\n"; print "Enter the letters to continue!\n" . "<form>\n". "<img src='" . $captchaimage . "'>\n". '</br>' . '<input type=text name=\'CAPTCHA\'>' . '</br>' . '<input type=submit value=\'Continue...\'>' . "\n</form>"; if (param()) { my $captcha = param('CAPTCHA'); chomp($captcha); $mech->submit_form( form_number => 1, fields => { 'CAPTCHA' => $captcha } ); $page = $mech->content; if ($page =~ /Thank you/) { print "Success!\n"; } else { print "Error!\n" } } } else { print "Error!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI script and captcha input
by jhourcle (Prior) on Jun 02, 2007 at 03:21 UTC | |
|
Re: CGI script and captcha input
by moritz (Cardinal) on Jun 02, 2007 at 10:46 UTC |