Perl - User Agnet ( Problem while acessing site )

M

mnrao13

Hi,
When i am trying to acess the the following
through user agent. I am not getting the response
properly.
URL:- https://accessnet.state.nj.us/home.asp
Code:-

$ua = LWP::UserAgent->new(agent =>'Mozilla/4.0
(compatible; MSIE 5.01; Windows NT 5.0)',
timeout => 45,

requests_redirectable => ['GET', 'HEAD', 'POST']);
$ua->cookie_jar($cookie_jar_tmp);

my $req = HTTP::Request->new(GET =>
'https://accessnet.state.nj.us/home.asp');
# send request
my $res = $ua->request($req);
my $r = $res;
my @redirects;
while ($r) {
$res = $r;
$r = $r->previous;
push (@redirects, $res) if $r;
}

print $res->as_string;

I am not getting the reason where i am failing. Please
help me out to acess the given URL through perl.

Thanks
Nageswara Rao.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,252
Latest member
MeredithPl

Latest Threads

Top