Im trying to hack together a perl script to screen scrape some data from
a table on a webpage and enter that data into a MySQL database.
This would be my first attempt using perl and HTML::TableContentParser.
The following script was created using bits and pieces ive found on
various perl examples on the web;
-------------------------------
#!/usr/bin/perl
#use strict;
use lib '/opt/local/lib/perl5/vendor_perl/5.8.6/';
use HTML::TableContentParser;
my $url =
'http://sonlite.dnr.state.la.us/sundown/cart_prod/cart_con_wellinfo2?p_wsn=8383';
use LWP::Simple;
my $content = get $url;
die "Couldn't get $url" unless defined $content;
$p = HTML::TableContentParser->new();
my $tables = $p->parse($content);
for $t (@$tables) {
for $r (@{$t->{rows}}) {
print "Row: ";
for $c (@{$r->{cells}}) {
print "[$c->{data}] ";
}
print "\n";
}
}
----------------------------------
My question is how do I refer to a specific entry,.. such as table 1 row
2 tabledata 2 without the loop?
If you were to look at the web page im scraping from you can see its
data on an oil well,.. I am only interested in the first 4 tables. I
want to set variables to each entry (my $serial =) so i can eaisly get
them into a database.
Does anyone have any insight that might help me out?
Dennis Bourn
GeoTech
CLK Energy
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>