Here is the code to login to the site:
use strict;
use WWW::Mechanize;
use Storable;
my $login = "user";
my $password = "pass";
my $session_name = "me";
my $filename = "out.txt";
my $filename2 = "out2.txt";
my $login_url = "https://esolutions.landauerinc.com/lisn/protected
+/default.aspx";
my $dh_url = "https://esolutions.landauerinc.com/lisn/protected/As
+signedDose.aspx";
# login to your LISN account
my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->get($login_url);
$mech->submit_form(
form_name => "_ctl0",
fields => {
txtUserName => $login,
txtPassword => $password
}
);
# my $c = $mech->content;
# open (FILE, ">out3.txt");
# print FILE $c;
# close FILE;
$mech->get($login_url ); #, ':content_file' => $filename );
# Enter Session Name
$mech->submit_form(
form_number => 1,
fields => {
txtUserName => $session
}
);
# Get Dose History Search Form
#$mech->get( $dh_url, ':content_file' => $filename );
#print " ", -s $filename, " bytes\n";
It is pretty straight forward, I based everything off of examples. I am calling $mech->get($login_url); twice because after a successful login it takes you back to a framed page, and I want to get back to the main page.
Here is the code for the http::recorder script:
use HTTP::Proxy;
use HTTP::Recorder;
my $proxy = HTTP::Proxy->new();
# create a new HTTP::Recorder object
my $agent = new HTTP::Recorder;
# set the log file (optional)
$agent->file("httpout.txt");
# set HTTP::Recorder as the agent for the proxy
$proxy->agent( $agent );
# start the proxy
$proxy->start();
1;
I took this straight from the http::recorder docs. Basically I was just hoping that someone could verify if http::recorer function the same way for them when they visit that page, but I would love if someone wants to help further.
As far as error codes. I am not receiving any, it is submitting the form but not loggin in, so I think it is the way that they are using/i am handling (or not handling) sessions.
Thank you all again for looking at this. |