S
sil
Hey all hoping someone can point me in the right direction on this.
I've set up a proxy server to log into another server on my LAN, this
other server is running ZenOSS and is configured to create reports and
email them upon login.... I figured I could leverage it for a coworker
or manager to auto generate a report based on a list so I created the
following: I have a file with names that reads like this:
# more names
name1
name2
name3
Need to take those names and do a POST using a proxy server... This is
what I have...
Doesn't work does anyone have a solution to read from a file and then
do a POST?
#!/usr/bin/perl -w
use strict;
use warnings;
use LWP;
my $data_file="names";
my $name;
my $browser = LWP::UserAgent->new;
$browser->agent('ZenOSS Report Generator');
$browser->proxy('10.10.15.20:3128');
open(FILE, $data_file) || die("Could not open file!");
while(<FILE>){
$name = $_;
print "Working on $name\n";
my $req = HTTP::Request->new(POST => "http://10.10.20.100/login.jsp?
UserID=$name&Password=password&x=27&y=28");
$req->content_type('application/x-www-form-urlencoded');
my $response = $browser->request($req);
print "Done: ", $response->status_line;
}
Thanks in advance
I've set up a proxy server to log into another server on my LAN, this
other server is running ZenOSS and is configured to create reports and
email them upon login.... I figured I could leverage it for a coworker
or manager to auto generate a report based on a list so I created the
following: I have a file with names that reads like this:
# more names
name1
name2
name3
Need to take those names and do a POST using a proxy server... This is
what I have...
Doesn't work does anyone have a solution to read from a file and then
do a POST?
#!/usr/bin/perl -w
use strict;
use warnings;
use LWP;
my $data_file="names";
my $name;
my $browser = LWP::UserAgent->new;
$browser->agent('ZenOSS Report Generator');
$browser->proxy('10.10.15.20:3128');
open(FILE, $data_file) || die("Could not open file!");
while(<FILE>){
$name = $_;
print "Working on $name\n";
my $req = HTTP::Request->new(POST => "http://10.10.20.100/login.jsp?
UserID=$name&Password=password&x=27&y=28");
$req->content_type('application/x-www-form-urlencoded');
my $response = $browser->request($req);
print "Done: ", $response->status_line;
}
Thanks in advance