Having Trouble with a CGI script login

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am trying to script a program to autologin for me with the following
HTML code data. Although for some reason I can not seem to be able to
fill the password field properly with WWW::Mechanize. Is the some
hidden jewel of syntax structure I am not yet aware of? Any help
concerning this issue would be much appreciated! :)

-Thanks in advance.


use WWW::Mechanize;
use WWW::Mechanize::FormFiller;

my $mech = WWW::Mechanize->new();
my $formfiller = WWW::Mechanize::FormFiller->new();

my $username = "user_name";
my $password = "password";
my $url = "http://www.myurl.com/default.aspx ";

# Grab the home page, and click the login button to redirect to the
correct page(HTML listed below).
$mech->click_button(number => 1);

# Set the username and password fields accordingly and submit.
$mech->set_visible( $username, [password => $password] ) ;

# Store new HTML content in a temporary file and open it for viewing.
$html = $mech->content();
open (OUT,">tmp.html");
print OUT $html;
close (OUT);


<body bgcolor="#FFFFFF">
<form id="frmLogin" name="frmLogin" method="post"
<input type="hidden" name="__VIEWSTATE"
<input type="hidden" name="__EVENTTARGET" value="">
<input type="hidden" name="__EVENTARGUMENT" value="">
<script language=javascript><!--
function __doPostBack(target, argument){
var theform = document.frmLogin
theform.__EVENTTARGET.value = target
theform.__EVENTARGUMENT.value = argument

// -->
<font size="-1" color="Black">Authorized users, please enter your
trading user ID and password:<br>
Please enter your user ID:<br>
<input name="txtUID" size="32"/><br>
Please enter your password:<br>
<input name="txtPWD" size="32" type="password"/><br>
<input name="cmdGo" type="image" src="Brand/00/go.gif" alt="Go"/><br>
<input name="cmdHomeFromfrmLogin" type="image" src="Brand/00/home.gif"

Re: Having Trouble with a CGI script login

<snip post identical to
1104951990.067980.17290@z14g2000cwz.googlegroups.com >

Why did you start a new thread?  Your last response in the other thread
indicated you'd solved your problem.  If this is not the case, you
should continue the original thread.  Please don't start another for no

Paul Lalli

Site Timeline