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

Simple PHP/Java Help..
Hi,
I'm trying to build a little program to do with calculating postage. Unfortunately i haven't

what business processes?
Hi,

A general question. What business processes (like OTC - Order to Cach, P2P, R2R etc)

SQL Injection
In my attempts to protect my database from mySQL injection I have created another problem for myself

Combining Two Queries
I have two scripts that each work fine by themselves. One is a search script with a variable that de

ALV sum various columns problem
Hi all,
I'm doing a report on ABAP for a timesheet of the current month. The output i want is s

Dynamic memory problem
Hey,

At the beginning of my code, I have this line:

Shape* gShape = 0;

I need some help with the IF command...
I have a large number of images in one section of my website with the .jpg format. I'm adding a bun

Changing color in GD via variable?
Hey guys, I'm new here. x)

I'm very much a noob when it comes to PHP, but I'm trying to learn

Need help with some php code :)
Hey! I'm quite new to this whole thing, so please don't fire me with shait on this one =D

I'm

Any meaningful project for a new C++ programmer?
I want to do some meaningful program, so I can help myself to learn

Assume I know the fol

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