I'm trying to pull the Ground Transit days off of the table at this URL:
http://www.dhl-usa.com/TransitTimes/USTTimeRslts.asp?nav=TransitTimes& +oz=53213&oc=1&oh=ORD&dz=60056&dc=1&dt=1/9/2006&tt=1&hy=&zn=2&am=Y
but I either get nothing (with the code I have here) or I get the error "can't call method "rows" on an undefined value at TableExtract.pm line 224.
$url="http://www.dhl-usa.com/TransitTimes/USTTimeStart.asp?nav=Transit +Times"; $service = "Service"; $arrival = "Arrival Date and Time"; $transit = "Days in Transit*"; my $mech = WWW::Mechanize->new(); $mech->get($url); $frmSvcCalc = "frmSvcCalc"; $mech->form_name($frmSvcCalc); $mech->set_fields( txtOrgZip => "53213", txtDestZip => "60056", ); $mech->field( "hdnAction", "Calculate" ); $mech->submit($frmSvcCalc); my $results2 = $mech->content; print OUTFILE $results2; $te = HTML::TableExtract->new( headers => [qw($service $arrival $trans +it)] ); $te->parse($html_string); foreach $ts ($te->tables) { print "Table (", join(',', $ts->coords), "):\n"; foreach $row ($ts->rows) { print join(',', @$row), "\n"; } }
The other code that I try that gives me the error is:
my $te = HTML::TableExtract->new( headers => [qw($service $arrival $tr +ansit)] ); $te->parse($html_string); foreach my $row ($te->rows) { foreach my $cell (@$row) { print $cell; } }
I've tried a few other ways, but I obviously don't & can't get it. I'm beggin for help, and so is my hair (or what's left of it).

In reply to Problems with TableExtract by bcdeery

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.