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

LWP Header Question

Thread Next
From:
Paul Maine Jr.
Date:
March 29, 2001 13:38
Subject:
LWP Header Question
Message ID:
2B8C29895AE9D311B8A6009027DE6F1C2C872C@mail.noc.msicc.com
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 => 'http://www.anycompany.com/');

  $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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About