Hello,
I am trying to create a new gmail account with WWW::Mechanize using the script below, but it is not working, and it keeps loading the sign up page eventhough all the fields are filled correctly.
Any suggestion or help would be really appreciated.
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
use HTTP::Cookies;
use LWP::Simple qw(getstore);
#use LWP::Debug qw(+ -conns);
###Field values
my $fname = 'john';
my $lname = 'smith';
my $login = 'testc.c.c.testc';
my $password = 'testtestc';
my $question = 'What is your primary frequent flyer number';
my $answer = 'my answer is the best answer';
my $google_captcha = '';
###Setup WWW::Mechanize
my $google = WWW::Mechanize->new();
$google->add_header( 'Accept-Encoding' => 'text/html' );
###Start
print "Fetching captcha image...\n";
$google->get('http://mail.google.com/mail/signup');
my @forms = $google->form_number(0);
getstore($google->value("newaccounturl"),'create_google_captcha.jpg');
print "image download (create_google_captcha.jpg)\n\nEnter captcha word: ";
$google_captcha = <>;
chomp($google_captcha);
$google->field("FirstName", $fname);
$google->field("LastName", $lname);
$google->field("Email", $login);
$google->field("Passwd", $password);
$google->field("PasswdAgain", $password);
$google->field("selection", $question);
$google->field("IdentityAnswer", $answer);
$google->field("newaccountcaptcha", $google_captcha);
$google->untick('PersistentCookie', "yes");
$google->untick('smhck', 1);
$google->click_button(name => "submitbutton");
###Output result
open (out,'>page.html');
print out $google->content();
close (out);
exit;