develooper Front page | perl.libwww | Postings from March 2001

LWP Header Question

Thread Next
Paul Maine Jr.
March 29, 2001 13:38
LWP Header Question
Message ID:
The following code works fine for returning header information for all web
sites I run it against except for one. The one unusual web site I run this
against returns the web document but does not print out any header
information. What could explain no header information?

Thank You
use LWP::UserAgent;

  $ua = LWP::UserAgent->new;

  #$ua->agent("$0/0.1 " . $ua->agent);

  $ua->agent("Mozilla/8.0"); # pretend we are very capable browser

  $req = HTTP::Request->new(GET => '');

  $req->header('Accept' => 'text/html');

  # send request

  $res = $ua->request($req);

  # check the outcome

  if ($res->is_success) {
     print $ua->request($req)->as_string;
  } else {

     print "Error: " . $res->status_line . "\n";


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About