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;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|