Current location: Hot Scripts Forums » Programming Languages » Perl » lwp error: Receiving http 500 error when submitting.....


lwp error: Receiving http 500 error when submitting.....

Reply
  #1 (permalink)  
Old 11-05-03, 12:30 AM
Qish Qish is offline
New Member
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
lwp error: Receiving http 500 error when submitting.....

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?aimWaitCancel=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_PLACEHOLDER">
<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" HEIGHT="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="javascript:popHomePage('/_cqr/homePg/hpController/controller.psp?siteId=snshomepage');"><IMG SRC="/images/sns_module_logo.gif" WIDTH="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="javascript:popHomePage('/_cqr/homePg/hpController/controller.psp?siteId=snshomepage');" class="snsNavbar"><IMG SRC="/images/t_Main.gif" width=33 height=16 alt="Main" border=0></A></td>
<td><A HREF="javascript:popHomePage('/_cqr/homePg/hpController/controller.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"></td>
</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 valid Screen Name consists of 3-16 characters and can contain letters, numbers, spaces, and must start with a letter (e.g., john doe123). Please 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. Please 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.aol.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=initiali zed&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="javascript:mcInfoPopUp(0, 'help.title','help.question1');" class="snsSmallTextLink">learn more</a>.
</div>
<p>
<div class="snsSmallTextBold">
You have a <a href="javascript:mcInfoPopUp(0, 'help.title','help.question5');" 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" width=130 height=16 alt="Screen Name Service"></p></td>
<TD align="right"><table border=0 cellspacing=0 cellpadding=0 width="233">
<tr>
<td><A HREF="javascript:mcInfoPopUp(1, '/help/privacyPolicy.psp?siteId=atlasaol');" class="snsNavbar"><IMG SRC="/images/b_PrivacyPolicy.gif"
width=83 height=16 hspace=0 border=0 alt="Privacy Policy"></A></td>
<td><A HREF="javascript:mcInfoPopUp(1, '/help/terms.psp?siteId=atlasaol');" class="snsNavbar"><IMG SRC="/images/b_TermsofUse.gif" width=78 height=16 hspace=0 border=0 alt="Terms of Use"></A></td>
<td><A HREF="javascript: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 your AOL Mail, enter your AOL Screen Name and password.<br><br> AOL Anywhere gives you the ability to access your AOL Mail whenever you're connected 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


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

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" => "ragdoll",
]
);

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>&nbsp; "



I think thats the problem... Please help.
Reply With Quote
  #2 (permalink)  
Old 11-07-03, 12:49 AM
Millennium's Avatar
Millennium Millennium is offline
Wannabe Coder
 
Join Date: Nov 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
I am not really sure, but it looks like your Perl script is trying to print something to the screen:

print "Bytes saved: ", -s $outfile, " in $outfile\n";

you may need to print an HTTP header first, just use this one for testing your script:

print qq~Content-type: text/html\r\n\r\n~;

place it anywhere in your script before the print line above.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 04:12 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.