I have the next problem:
I have a device that it has an xml page (http://IP_device/counters.xml), I want to monitor this file for extract some information. The problem comes because for access to this file, previously I must login into a form (http://IP_device/frameCmd_Login.htm) like this:
<form method="get" action="/Action_Login" onsubmit="return MD5HASH()">
<font color="#000000" align="center">Please Enter Password</font>
<input size="21" type="password" value="" name="LOGINPASSWORD" id="PD" />
<input name="submit" type="submit" value="LOGIN" />
For that I need to log in into the form before (http://IP_device) and then download the xml file.
I've tried with the LWP, URL modules but I don't know how to do this. I'm a newbie with perl. The perl script I've tried is:
#!/usr/bin/perl
use LWP::UserAgent;
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request(GET => 'http://IP_device/frameCmd_Login.htm');
$req->authorization_basic("password123");
my $res = $ua->request($req);
if ($res->is_success)
{
my $file = $res->content;
print $file;
}
else
{
die $res->status_line;
}
Anyone knows how to achieve this issue? Anyone can help me?