I have been scanning through the libwww archives and have been unable to get
any of the similar solutions to work, so I thought I would send an email
here and see if someone can help me figure out what I am doing wrong....

Brief Desc:  I am trying to create a script that will automate using HP's
Custom Patch Manager.  In case your not familiar it allows you send a list
of software installed on your system to HP, and shows you a list of patches
that they suggest you install.  Anyway, at the moment it is a very time
consuming process, to click through the pages 1 server at a time,
(especially with 40+ servers).

I have gotten some things to work, but not to HP's site.  I think a lot of
the problem has to do with the cookies, and the Java Script.  But when I try
what I think will work, I keep getting referred to a different page saying
that the page I am looking for is somewhere else.  Its not saying that I am
not logging in, although that's what I believe is happening.

Anyway... Here is my script..   


#!/opt/perl/bin/perl

use LWP::UserAgent;
use HTTP::Cookies;
use HTML::Form;

$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);

$cookie_jar = HTTP::Cookies->new(file => "lwpcookies.txt",autosave => 1);

my $req = new HTTP::Request GET =>
'http://us-support.external.hp.com/login/bin/doc.pl/screen=loginServiceLogin
Form';
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');
$cookie_jar->add_cookie_header($request);

my $res = $ua->request($req);
$cookie_jar->extract_cookies($res);
$content = $res->content();
my $form = HTML::Form->parse($res->content,
'http://us-support.external.hp.com/');

$form->value('USER_ID', 'USER');
$form->value('PASSWORD', 'PASSWORD');

$req = $form->click;

my $res = $ua->request($req);

print $res->content;

exit();


Reply via email to