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

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top