Hello perl gurus...I've been struggling with reformatting the output of data in HTML::TableExtractor. Here is ultimately what I want to do: 1) Go to website 2) Scrape table on website based on their location on the page, because there are no freakin headers! 3) Pull the information gathered into a mysql database
So far, here is what I've gotten:
use lib qw( ..);
use HTML::TableExtract;
use LWP::Simple;
use Data::Dumper;
my $te = new HTML::TableExtract( depth=>3, count=>0, gridmap=>0);
my $content =
get("http://www.servpro.com/locator/lookup.asp?stname=Alabama&state=AL");
$te->parse($content);
foreach $ts ($te->table_states)
{
foreach $row ($ts->rows)
{
print Dumper $row;
# print Dumper $row if (scalar(@$row) == 2);
}
}
If you save the above, and run it from your cmd prompt, it creates a very messy return, but hey, at least its something right! What I want to do is structure the data into an array so I can send the information to a mysql database.
I have no idea how to get HTML::TableExtractor to bring in an orderly fashion. I've tried to see what it is returning by simply printing one of the variables (like $row rather than using the DUMPER function) HTML::TableExtractor is tabulating, and it comes back by printing something like: "ARRAY(0x1b3243f)ARRAY(0x1b3432)"
First off, what are the strange things it is returning? I've never used dumper, but don't really like it. I would prefer to set a new string equal to each variable in the array. Then send that information to mysql.
One other quick question, can anyone tell me in plain english what
"foreach $ts ($te->table_states)" is telling the computer program to do?
Any help is greatly appreciated...hope everyone has a good weekend! :)
I need to go meditate after working on this stupid thing all day! OOOOOOOOOOOOOOOMMMMMMMMMMMMMMMMMMMMM
In reply to PERL HTML::TableExtractor by jdlev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |