Help with parsing this html


Posted on 16th Feb 2014 07:03 pm by admin

Hi,
I've got some html i just need a couple of strings from.. argh, it's freaking me out. I've tried a lot.

Here is the html:
Code: <div id="Tab01" style="overflow: auto; overflow-x:hidden; height: 2800px; width:930px">
<table style="width:930px;background-color:#deded5; border-style:dotted; border-width:1px; border-color:#79796F; border-top:none"><tr>
<td style="width:40px">&nbsp;</td><td style="width:50px"><font class="overskrift2-ruteoversikt">Rutenr.:</td><td style="360px"><font class="overskrift2-ruteoversikt">Rutenavn:</td>
<td style="width:40px">&nbsp;</td><td style="width:50px"><font class="overskrift2-ruteoversikt">Rutenr.:</td><td style="360px"><font class="overskrift2-ruteoversikt">Rutenavn:</td>
</tr>
</table>
<table style="background-color:#f3f3de;width:924px;height:369px;border-style:dotted;border-width:1px;border-color:#79796F;border-top:none">
<tr valign="top">
<td>
<table style="width:462px">
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-100.htm">01-100</a></td><td style="width:360px">Moss-Fredrikstad-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-102.htm">01-102</a></td><td style="width:360px">Halden-Parken-Tistedal-Vold skog-Parken-Stenrød-Brekkerød-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif"
align="center"></td><td style="width:50px"><a
href="../t/01-104.htm">01-104</a></td><td
style="width:360px">Halden-Parken-Tistedal-Næringsrød-Parken-Remmen-Bjørklund-Sy
kehuset-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-105.htm">01-105</a></td><td style="width:360px">Halden-Stangeløkka-Refne-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-110.htm">01-110</a></td><td style="width:360px">Halden-Sørli-Isebakke</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-111.htm">01-111</a></td><td style="width:360px">Halden-Svinesund-Strömstad</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-112.htm">01-112</a></td><td style="width:360px">Halden-Knardal-Hov-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-113.htm">01-113</a></td><td style="width:360px">Halden-Holtet-Bakke-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-114.htm">01-114</a></td><td style="width:360px">Halden-Aspedammen-Prestebakke-Kornsjø-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-115.htm">01-115</a></td><td style="width:360px">Halden-Elgklev</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-118.htm">01-118</a></td><td style="width:360px">Halden-Isebakke-Svinesund-Sponvika-Halden</td></tr>
</table>
</td>
<td>
<table style="width:462px">
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-121.htm">01-121</a></td><td style="width:360px">Halden-Torpedal-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-123.htm">01-123</a></td><td style="width:360px">Fjeld bru-Jørkebekk-Østkroken-Aremark</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-124.htm">01-124</a></td><td style="width:360px">Aremark-strømsfoss-Vestsida-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-131.htm">01-131</a></td><td style="width:360px">Ørje-Kasbo-Buer-Engsødegård-Granerud</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-132.htm">01-132</a></td><td style="width:360px">Ørje-Damholtet-Strømsfoss</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-140.htm">01-140</a></td><td style="width:360px">Halden-Aremark-Strømsfoss-Granerud-Ørje</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/FERJE-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-150.htm">01-150</a></td><td style="width:360px">Skjærhalden-Hvaler</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BAAT-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-191.htm">01-191</a></td><td style="width:360px">Strømsfoss-Tistedal/Ørje</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-192.htm">01-192</a></td><td style="width:360px">Halden-Brekkerød-Halden</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-194.htm">01-194</a></td><td style="width:360px">Halden ringbuss</td></tr>
<tr valign="top"><td style="width:40px"><IMG SRC="../images/BUSS-s.gif" align="center"></td><td style="width:50px"><a href="../t/01-199.htm">01-199</a></td><td style="width:360px">Skolebuss Halden</td></tr>
</table>
</td>
</tr>
</table>
</div>
I want to parse this html, and put in a mysql database based on 2 fields.
The first one is the bus number.

All these are the bus numbers: <a href="../t/01-100.htm">01-100</a>
And all these are the places: <td style="width:360px">Moss-Fredrikstad-Halden</td>

But theres one more thing. The bus number and the place is connected to each other, so I need to find a way to parse them so they doesn't get mixed up.

Any help please?

No comments posted yet

Your Answer:

Login to answer
107 Like 52 Dislike
Previous forums Next forums
Other forums

A little help needed passing hidden values to next page
I have a page that has hidden values in a form.

example
Code: <input name='signupID

convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javasc

How to show more than 1 users with this code...
Hello,
i have a table that shows users only if I, as Administrator, want to be shown. But its sho

Custom list order
Hi there,

I have checked this tutorial and it's great till the point where I want to display

Display error above the login forum help!
Hi guys. just so you know im not asking for someone to do this for me I just need to be pointed in t

Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but h

Update data to upper case in parent/child tables
Hi Gurus!

In production we have a product table and which is being reference by many tabl

PHP Cannot redeclare class
I have 6 files, and two of them do not seem to want to play well. I keep getting a "Cannot rede

Having a problem get the selected item from a drop down menu
I have been looking at this for days now.

I have a drop down menu that get it's values from a

Modal Popup Help
Hi guys, I have a modal popup with an iframe. How can i send data from a label or textbox to the ifr

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash