I am hoping a monk here can help me figure out what is going around with this fairly short login script. I'm trying to log in to http://www.justanswer.com/login.asp . There is a email and password field AND a radio button which must be set to 'returning' since I already have an account.
The below script keeps coming back as if I never set the radio button saying I'm a user. The mech->content test print out shows my email filled out but the radio button isn't pushed. Can you see what I may be doing wrong?
The relevant HTML code from what I can see is..
<form name="aspnetForm" method="post" action="/account/sign-in.asp
+x" id="aspnetForm">
<input class="JA_field" type="text" id="JA_email" name="email" maxlen
+gth="75" value="" tabindex="1" />
<input class="JA_field" type="password" id="JA_password" name="passwor
+d" maxlength="75" tabindex="5" />
<input class="JA_radio" type="radio" id="JA_returning" name="sign_in_
+type" value="returning" tabindex="3" checked="checked"/>
My code is below.
use WWW::Mechanize;
my $email = '';
my $password = '';
my $ja_login = 'http://www.justanswer.com/login.asp';
my $answer_page = 'http://www.justanswer.com/expert/question-list.aspx
+';
my $confirm_signon = 'My Questions';
print header, start_html("JA");
my $mech = WWW::Mechanize->new(agent => 'InternetExplorer 8');
my $login_get = $mech->get($ja_login);
$mech->submit_form(
form_name => 'aspnetForm',
fields => {
email => $email,
password => $password,
sign_in_type => 'returning',},
);
if ($mech->content !~ m/$confirm_signon/)
{
print "Failed to sign on";
print $mech->content;
exit;
}
$mech->get($answer_page);
print $mech->content;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.