Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

searching a webpage

by bcdeery (Novice)
on Jan 06, 2006 at 21:05 UTC ( #521638=perlquestion: print w/replies, xml ) Need Help??

bcdeery has asked for the wisdom of the Perl Monks concerning the following question:

My program starts at the following url: after I have it enter the zip codes (53213, 60056) and go to the next page, the url is +oz=53213&oc=1&oh=ORD&dz=60056&dc=1&dt=1/6/2006&tt=1&hy=&zn=2&am=Y

How do I do a search (and print) the number of days in transit (in this case "1"). Every search I try seems to come up without finding the phrase. The immediate phrase of the HTML that the "1" is in <div class="pL5">1 is repeated 17 times in this page, but that may vary. I tried to do a search on the paragraph of HTML code that contains the "1" that I need:

DHL Ground Service</a> <br> (Letter &#150; 150 Pounds)</div></td> + <td><div class="pL5">Monday,&nbsp;Jan&nbsp;9,&nbsp;2006 &n +bsp;By end of day<img src="" w +idth="1" height="1"></div></td> <td><div class="pL5">1
, but it won't find it. I'm just using
if( $mech->content =~ m{WHAT I'M SEARCHING FOR COPIED FROM THE SOURCE +CODE}) { print "Ground Service is available";
Any suggestions?

Edit: g0n - code tags around long url

Replies are listed 'Best First'.
Re: searching a webpage
by johnnywang (Priest) on Jan 06, 2006 at 21:18 UTC
    The content is layed out in tables, which is perfect for the wonderful module: HTML::TableExtract
Re: searching a webpage
by marto (Cardinal) on Jan 07, 2006 at 00:29 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://521638]
Approved by johnnywang
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2021-01-26 22:51 GMT
Find Nodes?
    Voting Booth?