Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Parsing HTML with PHP
Old 07-13-2011, 11:56 AM Parsing HTML with PHP
Novice Talker

Posts: 9
Name: Rahul Parkar
Trades: 0
So the issue I have is that I need to parse this HTML with PHP

HTML Code:
<h3 style='text-align:left'>ARCHERFIELD (YBAF)</h3><table border="0" cellpadding="0" cellspacing="0" width="100%">   <tr>     <td width="5%">     <td width="55%"><a href=BAFAD01-126.pdf>AERODROME CHART PAGE 1</a></td>     <td width="40%">10-Mar-2011<span class='pt8arialteal'> (Am 126)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=BAFAD02-126.pdf>AERODROME CHART PAGE 2</a></td>     <td width="40%">10-Mar-2011<span class='pt8arialteal'> (Am 126)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=BAFDP01-126.pdf>SID ARCHERFIELD SEVEN DEP (RADAR) - RWY 10L/28R</a></td>     <td width="40%">10-Mar-2011<span class='pt8arialteal'> (Am 126)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=BAFNB02-123.pdf>NDB-B</a></td>     <td width="40%">03-Jun-2010<span class='pt8arialteal'> (Am 123)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=BAFNB03-123.pdf>NDB-C</a></td>     <td width="40%">03-Jun-2010<span class='pt8arialteal'> (Am 123)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=BAFGN01-125.pdf>RNAV (GNSS) RWY 28R</a></td>     <td width="40%">18-Nov-2010<span class='pt8arialteal'> (Am 125)</span></td>   </tr> </table>  <h3 style='text-align:left'>ARGYLE (YARG)</h3><table border="0" cellpadding="0" cellspacing="0" width="100%">   <tr>     <td width="5%">     <td width="55%"><a href=ARGAD01-120.pdf>AERODROME CHART</a></td>     <td width="40%">27-Aug-2009<span class='pt8arialteal'> (Am 120)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=ARGDG01-120.pdf>DME OR GPS ARRIVAL</a></td>     <td width="40%">27-Aug-2009<span class='pt8arialteal'> (Am 120)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=ARGVO01-120.pdf>VOR RWY 19</a></td>     <td width="40%">27-Aug-2009<span class='pt8arialteal'> (Am 120)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=ARGVO02-120.pdf>VOR-A</a></td>     <td width="40%">27-Aug-2009<span class='pt8arialteal'> (Am 120)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=ARGGN01-120.pdf>RNAV (GNSS) RWY 01</a></td>     <td width="40%">27-Aug-2009<span class='pt8arialteal'> (Am 120)</span></td>   </tr>   <tr>     <td width="5%">     <td width="55%"><a href=ARGGN02-120.pdf>RNAV (GNSS) RWY 19</a></td>     <td width="40%">27-Aug-2009<span class='pt8arialteal'> (Am 120)</span></td>   </tr> </table>
But the way I need to parse it is basically, for each H3, look for the table next to it, then parse through the TR's to get the TD's...

I've tried in every way to use DOM, but I can't get that to work so I scrapped the idea...

Anybody got any ideas?

Cheers!
Rahul
rahulp959 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-13-2011, 02:14 PM Re: Parsing HTML with PHP
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://simplehtmldom.sourceforge.net/
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Parsing HTML with PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27775 seconds with 12 queries