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

#!/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"; }
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>

In reply to perl lwp by perl_sakthe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.