Click here to get back home

Having Trouble with a CGI script login

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Having Trouble with a CGI script login WhiteFungus 01-06-2005
Posted by WhiteFungus on January 6, 2005, 1:16 pm
Please log in for more thread options
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.
_______________________________________________________________

#!usr/bin/perl

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->get($url);
$mech->click_button(number => 1);

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

# 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);
system("tmp.html");

_______________________________________________________________

<html>
<head>
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<form id="frmLogin" name="frmLogin" method="post"
action="Login.aspx?__ufps=933290">
<input type="hidden" name="__VIEWSTATE"
value="aDxfX1A7QDw716znrKftnYTgo4csMTs+Oz6urRmZvy6aJZj20y+gGEkgSS1/NA==">
<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
theform.submit()
}

// -->
</script>
<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"
alt="Home"/></font></form></body></html>
_______________________________________________________________



Similar ThreadsPosted
Having Trouble with a CGI script login January 6, 2005, 1:16 pm
Having Trouble with a CGI script login January 5, 2005, 12:51 pm
how can I login the web August 6, 2006, 3:40 am
login to National Post using LWP January 4, 2006, 11:30 pm
encapsulation of session/secure login: looking for perl mod September 29, 2004, 7:29 am
[DBI][Oracle] providing login/password, but having ORA-01004 November 15, 2004, 9:44 am
Trouble installing GD November 5, 2004, 10:51 am
PerlEx3 trouble September 27, 2006, 11:50 am
Trouble compiling module IO 1.20 August 6, 2004, 1:25 pm
Trouble installing from CPAN November 20, 2006, 11:43 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap