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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.