I'm working with libwww for the first time. I am trying to parse the content on a html page on a intranet server to find a certain error code.
Basically, what I'm using is this:
$fileToCheck = 'http://internalservername/';
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("MyFirstAgent /" . $ua->agent);
$req = new HTTP::Request HEAD => $fileToCheck;
$res = $ua->request($req);
if ($res->is_success) {
print "file $fileToCheck exists\n";
print $res->content;
} else {
print "file $fileToCheck doesn't exist\n";
}
$res->content is always nothing. That's my problem. When I break there, and 'X res', here's what my feedback looks like:
'_content' => ''
'_headers' => HTTP::Headers=HASH(0x11297c4)
'accept-ranges' => 'bytes'
'client-date' => 'Fri, 15 Sep 2000 10:58:34 GMT'
'client-peer' => '10.0.0.4:80'
'content-length' => 1775
'content-location' => 'http://internalservername/Default.htm'
'content-type' => 'text/html'
'date' => 'Fri, 15 Sep 2000 11:01:05 GMT'
'etag' => '"0a4e2ee8cc7bb1:20ee"'
'last-modified' => 'Fri, 01 Nov 1996 00:38:00 GMT'
'server' => 'Microsoft-IIS/4.0'
'_msg' => 'OK'
'_protocol' => 'HTTP/1.1'
'_rc' => 200
'_request' => HTTP::Request=HASH(0x1126338)
'_content' => ''
'_headers' => HTTP::Headers=HASH(0x1126308)
'user-agent' => 'MyFirstAgent /libwww-perl/5.45'
'_method' => 'HEAD'
'_uri' => URI::URL=ARRAY(0x11263d4)
0 URI::http=SCALAR(0x10f8628)
-> 'http://internalservername/'
1 undef
Is libwww such that an http://internalservername won't work? Does it have to be a IP Address or a www.*.com address? Am I barking up the wrong tree with libwww and should be using Sockets instead? Any help would be appreciated!
margaret
no spiffy quotes.