Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi Im working on a perl lwp browser that will allow me to automate my login to my aol email account. Heres the html source of the website (my code is under it)
------------------------------------------------------------
"http://my.screenname.aol.com/_cqr/login/aimAutoLoginFail.psp?aimWaitC +ancel=y&triedAimAuth=y" : <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1 +"> <HTML> <HEAD> <title>Screen Name Service</title> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF8CONV_P +LACEHOLDER"> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> </SCRIPT> <SCRIPT LANGUAGE="JavaScript" SRC="/mcLib.js.psp"></SCRIPT> <LINK REL="stylesheet" TYPE="text/css" HREF="/style/snsStyles.css"> <style type="text/css"> .snsSmallText { color: #000000 } .snsSmallTextBold { color: #000000 } .snsSmallTextLink { color: #003366 } .snsSmallTextBoldLink { color: #003366 } .snsSmallestText { color: #000000 } .snsMediumText { color: #000000 } .snsMediumTextBold { color: #000000 } .snsMediumTextBoldLink { color: #003366 } .snsHeadline { color: #000000 } .snsFieldLabel { color: #000000 } .snsFieldSubtext { color: #0066FF } </style> </HEAD> <BODY TOPMARGIN="15" LEFTMARGIN="60" MARGINHEIGHT="15" MARGINWIDTH="60 +"> <TABLE WIDTH="585" BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TR> <TD COLSPAN="3" ALIGN="left" VALIGN="bottom"><IMG SRC="http://webmail. +aol.com/include/aol/images/logo-sns-signin.gif" ALT="Partner Image" H +EIGHT="45" WIDTH="345" VSPACE="5"></TD> </TR> <TR> <TD> <TABLE WIDTH="365" BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR= +"#003366"> <tr> <td><img src="/images/dot.gif" height=1 width=1></td> <td><img src="/images/dot.gif" height=1 width="130"></td> <td><img src="/images/dot.gif" height=1 width="233"></td> <td><img src="/images/dot.gif" height=1 width=1></td> </tr> <TR> <TD WIDTH="1" ROWSPAN="6"><IMG SRC="/images/transparentgif.gif"></TD> <TD> <a href="java_script_:popHomePage('/_cqr/homePg/hpController/controlle +r.psp?siteId=snshomepage');"><IMG SRC="/images/sns_module_logo.gif" W +IDTH="125" HEIGHT="15" alt="Screen Name Service" vspace=5 border=0></ +a></TD> <TD ALIGN="RIGHT"> <table border=0 cellspacing=0 cellpadding=0> <tr> <td> <A HREF="java_script_:popHomePage('/_cqr/homePg/hpController/controlle +r.psp?siteId=snshomepage');" class="snsNavbar"><IMG SRC="/images/t_Ma +in.gif" width=33 height=16 alt="Main" border=0></A></td> <td><A HREF="java_script_:popHomePage('/_cqr/homePg/hpController/contr +oller.psp?hpState=hpHelp&siteId=snshomepage');" class="snsNavbar"><IMG SRC="/images/t_Help.gif" width=31 height=16 alt +="Help" border=0></A></td> </tr> </table> </TD> <TD WIDTH="1" ROWSPAN="6"><IMG SRC="/images/transparentgif.gif"></TD> </TR> <TR> <TD COLSPAN="2" ALIGN="CENTER" VALIGN="MIDDLE" BGCOLOR="lightgrey"></t +d> </TR> <tr> <td colspan=2 BGCOLOR="#FFFFFF"><img src="/images/dot.gif" height=5></ +td> </tr> <TR> <TD COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" BGCOLOR="#FFFFFF"> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- function validateSigninForm() { // this checks the screenname value first // and then if that's ok, it checks that the password isn't empty if (mcCheckScreenName(document.signinForm.screenname.value, 1, 'A vali +d Screen Name consists of 3-16 characters and can contain letters, nu +mbers, spaces, and must start with a letter (e.g., john doe123). Plea +se re-type your Screen Name.')) { var password = document.signinForm.password.value; if ((password == null) || (password == "")) { alert("You entered a password that is either too short or too long. Pl +ease enter a password that is 4-16 characters in length."); return false; } else { return true; } } else { return false; } } //--> </SCRIPT> <FORM METHOD="POST" NAME="signinForm" ACTION="https://my.screenname.ao +l.com/_cqr/login/login.psp" onSubmit="return validateSigninForm();"> <input type="hidden" name="charset" value="iso-8859-1"> <INPUT TYPE="HIDDEN" NAME="siteState" VALUE=""> <INPUT TYPE="HIDDEN" NAME="siteId" VALUE="atlasaol"> <INPUT TYPE="HIDDEN" NAME="newSN" value="0"> <INPUT TYPE="HIDDEN" NAME="mcState" value="initialized"> <INPUT TYPE="HIDDEN" NAME="authLev" value="2"> <INPUT TYPE="HIDDEN" NAME="submitSwitch" VALUE="1"> <INPUT TYPE="HIDDEN" NAME="triedAimAuth" VALUE="y"> <table width="363" border=0 cellpadding=0 cellspacing=0> <tr valign="top"> <td rowspan=4 width="20">&nbsp;</td> <td colspan=2 width="157"> <div class="snsHeadline">Sign In</div> <div style="line-height: 10px;">&nbsp;</div> <div class="snsFieldLabel">Screen Name </div> <INPUT TYPE="TEXT" NAME="screenname" SIZE="16" VALUE="" MAXLENGTH="16" + tabindex=1> <div class="snsFieldSpacer">&nbsp;</div> <div class="snsFieldLabel">Password</div> <INPUT TYPE="PASSWORD" NAME="password" SIZE="16" VALUE="" MAXLENGTH=16 + tabindex=2><br> <A HREF="/_cqr/login/login.psp?cf=lost&siteId=atlasaol&mcState=initial +ized&authLev=2" class="snsSmallTextLink">I forgot my password.</A> <div class="snsFieldSpacer">&nbsp;</div> </td> <td rowspan=3 width="10">&nbsp; </td> <td rowspan=3 width="166"> <div class="snsMediumTextBold">Signing in is easy!</div> <div class="snsSmallText"> Sign into our network of sites with your Screen Name and Password. <a href="java_script_:mcInfoPopUp(0, 'help.title','help.question1');" +class="snsSmallTextLink">learn more</a>. </div> <p> <div class="snsSmallTextBold"> You have a <a href="java_script_:mcInfoPopUp(0, 'help.title','help.que +stion5');" class="snsSmallTextBoldLink">Screen Name</a> if you use: </div> <div class="snsSmallText">America Online<BR>Compuserve 2000<BR>AIM<BR> +Netscape<BR></div> </td> <td rowspan=4 width="10">&nbsp;</td> </tr> <tr valign="top"> <td width=10> </td> <td width=147> </td> </tr> <tr valign="top"> <td colspan=2 valign="bottom"> <INPUT TYPE="SUBMIT" VALUE="Sign In" tabindex=4>&nbsp; <INPUT TYPE="BUTTON" VALUE="Cancel" onClick="document.location='/_cqr/ +login/loginCancel.psp?siteId=atlasaol&siteState=';" tabindex=5> </td> </tr> <tr valign="top"> </tr> </table> <SCRIPT LANGUAGE="JavaScript"> <!-- function mcIsNav47() { if (navigator.appName != 'Netscape' || (navigator.appVersion.substring +(0,3) != '4.7' && navigator.userAgent.indexOf('NSCP') == -1)) { return 0; } else { return 1; } } function setFieldFocus() { document.signinForm.screenname.focus(); } if (mcIsNav47() == 0) { // set the focus now, and again when the page is done // just in case anything steals focus from this field document.signinForm.screenname.focus(); window.onload = setFieldFocus; } //--> </SCRIPT> </TD> </TR> <tr> <td colspan=2 BGCOLOR="#FFFFFF"><img src="/images/dot.gif" height=8></ +td> </tr> <TR> <td><p class="snsNavbar"><IMG SRC="/images/b_ScreenNameService.gif" wi +dth=130 height=16 alt="Screen Name Service"></p></td> <TD align="right"><table border=0 cellspacing=0 cellpadding=0 width="2 +33"> <tr> <td><A HREF="java_script_:mcInfoPopUp(1, '/help/privacyPolicy.psp?site +Id=atlasaol');" class="snsNavbar"><IMG SRC="/images/b_PrivacyPolicy.g +if" width=83 height=16 hspace=0 border=0 alt="Privacy Policy"></A></td> <td><A HREF="java_script_:mcInfoPopUp(1, '/help/terms.psp?siteId=atlas +aol');" class="snsNavbar"><IMG SRC="/images/b_TermsofUse.gif" width=7 +8 height=16 hspace=0 border=0 alt="Terms of Use"></A></td> <td><A HREF="java_script_:mcInfoPopUp(1, '/help/securityTip.psp?siteId +=atlasaol');" class="snsNavbar"><IMG SRC="/images/b_SecurityTip.gif" +align="right" width=72 height=16 hspace=0 border=0 alt="Security Tip"></A></td> </tr> </table></TD> </TR> <tr> <td colspan=4><img src="/images/dot.gif" height=5></td> </tr> </TABLE> </form> </TD> <TD WIDTH="20">&nbsp;</TD> <TD VALIGN="TOP" WIDTH="200"> <div class="snsSmallText"><b>AOL Members:</b> To sign in and access yo +ur AOL Mail, enter your AOL Screen Name and password.<br><br> AOL Any +where gives you the ability to access your AOL Mail whenever you're c +onnected to the World Wide Web. </div> </TD> </TR> </TABLE> </BODY> </HTML>

------------------------------------------------------------<
I have all the variable names figured out.. however Im having trouble assigning a variable name to the submit value. Someone told me not to worry about it and send everything else, but that returned an http 500 error, which signifies the cgi script didnt run. Im thinking thats because it wasnt submitted properly??.. I dont know... heres the code for the lwp program

------------------------------------------------------------
<br> use strict; my $outfile = "result_test.html"; use LWP; my $browser = LWP::UserAgent->new; $browser->cookie_jar( {} ); my $response = $browser->post( 'http://my.screenname.aol.com/_car/login/login.psp', [ "charset" => "iso-8859-1", "siteState" => "", "siteId" => "atlasaol", "newSN" => "0", "mcState" => "initialized", "authLev" => "2", "submitSwitch" => "1", "triedAimAuth" => "y", "screenname" => "kmcp12", "password" => "notmypassword", ] ); die "Error: ", $response->status_line, "\n" unless $response->is_success; open(OUT, "$outfile") || die "Can't write-open $outfile: $!"; binmode(OUT); print OUT $response->content; close(OUT); print "Bytes saved: ", -s $outfile, " in $outfile\n";

--------------------------------------------------------

I dont know what to do about this line from the html source

" <INPUT TYPE="SUBMIT" VALUE="Sign In" tabindex=4>  "

I think thats the problem... Please help.

janitored by ybiC: Balanced <readmore> tags around sample markup and code


In reply to lwp error: Receiving http 500 error when submitting..... by Qish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found