I'm trying to write a program that will do a screen scrape of "WhatsUp
Gold" using LWP.  When it pulls the page down, I want to parse it and
I'm looking for data between 2 tags.  I'm having problems with parsing
the variable $content.  This variable holds the HTML of the page.  When
I run the program I get only a blank line back.

I will use the data from this to update a text file which feeds a java
scroller.  It's really just a learning project right now.

Here is the code I have so far:

%<------------------------------------------------------------------->%

#!/usr/bin/perl

use strict;
use LWP;
my $url =
"http://10.200.2.123/map.asp?map=SandBox.wup&MapViewMode=Summary";;
my @location;
my $location2;

my $browser = LWP::UserAgent->new;
$browser->credentials(
  '10.200.2.123:80',  # Don't forget the ":80"!
  # This is no secret...
  'secret area',
  'user1' => 'password'
);

my $response = $browser->get($url);
die "Error getting $url: ", $response->status_line
  if $response->is_error;

my $content = $response->content();

@location = $content =~ m{MapViewMode=Summary">([^<]*)</TR>}g;
print "@location[0]\n";

%<------------------------------------------------------------------->%

Here is the HTML that $content contains:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
Whatsup Gold 7
map.asp
----------------
Displays a picture of the map on the left
and map centric links on the right.
Requires a Map to be in context.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
Whatsup Gold 7
mapdetails.asp
----------------
Displays a picture of the map on the left
and map centric links on the right.
Requires a Map to be in context.
-->
<HTML>
<HEAD>
<TITLE>WhatsUp Gold - Testing Box</TITLE>
<META http-equiv="REFRESH" content="60">
</HEAD>
<BODY bgColor="#ffffff">
<TABLE cellSpacing=0 cellPadding=3 width="98%" bgColor="#c0c0c0"
border=2>

... < LOTS OF STUFF CUT OUT > ...

<A
href="device.asp?map=SandBox.wup&device=1279212986&MapViewMode=Summary">test device</A>
*</TD>
<TD align=right bgColor="#FFFF77">ICMP</TD>
<TD align=right>14</TD>
<TD align=right>35.71%</TD>
<TD align=right>64.29%</TD>
<TD align=right>0:09</TD>
<TD align=right>0:13</TD>
<TD align=right>0</TD>
<TD align=right>0</TD>
<TD align=right>0</TD>
<TD align=right>0</TD>
</TR>

... < LOTS OF STUFF CUT OUT > ...

</BODY></HTML>

%<------------------------------------------------------------------->%

-- 
Ray Seals <[EMAIL PROTECTED]>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to