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"> </td><td style="width:50px"><font class="overskrift2-ruteoversikt">Rutenr.:</td><td style="360px"><font class="overskrift2-ruteoversikt">Rutenavn:</td>
<td style="width:40px"> </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
52
Other forums
Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and ex
Printer configuration
Hi All,
Suppose one of the user deleted the printer settings unfortunatly ,then what is the pro
Does deleting the spmlog directory critical?
Hi Everyone,
Please, hope you could help me. We're having problems with the SAP backup. I
Program with calculate Meteorologic measurements
Hello I'm a beginner and I want to make a program with calculate Meteorologic measurements:
ba
Problem assigning value to variable in "IF" function
Does this script makes sense? I am trying to take the value that is set to "authenticat" a
Retrieving innerHTML with cURL?
Hey all (sorry I know I'm a leecher, but I soon won't be. This is my first PHP project, but not my l
Array to string conversion
Can anyone help me with this?
Notice: Array to string conversion in /home/..../index.php on l
Renaming a file that a user uploads to site?
My site allows for registered users to upload images to the site under their own gallery. Currently
Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou
COOIS - Saving Object Overview WIP Status layouts
COOIS - Would like to be able to save the layout of an Object Overview - WIP Status report. There i