hi all, From perl I need to hit the url and retrieve the contents. I am using the LWP module to hit the url. But the contents are empty and also, i am getting the header as HTTP/0.9 200 (OK) EOF. Can you please tell why i am getting this issue
Result is New url :http://www.google.com/ Response Headers: Client-Date: Tue, 07 Feb 2012 10:17:21 GMT Client-Peer: 74.125.113.106:80 Client-Response-Num: 1 ====================================================================== HTTP/0.9 200 (OK) EOF Client-Date: Tue, 07 Feb 2012 10:17:21 GMT Client-Peer: 74.125.113.106:80 Client-Response-Num: 1 ====================================================================== Content_type: </code>#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTTP::Request; use LWP 5.00; use URI::URL; my $url='http://www.google1.com/'; my $ua = LWP::UserAgent->new(env_proxy => 1,keep_alive =>1, timeout => +30); my $header = HTTP::Request->new( GET => $url); my $req = HTTP::Request->new('GET', $url,$header); #PASS REQUEST my $res = $ua->request($req); #GET RESULTS if($res->is_success) { print "New url :",$url,"\n"; print "Response Headers:\n"; print $res->headers_as_string; print '='x70,"\n",$res->as_string(), '='x70,"\n"; print "Content_type:".$res->content_type . "\n"; } else { print "No response\n"; print $res->status_line . "\n"; }
In reply to perl lwp by perl_sakthe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |