<TABLE border="2"
style="background : #173D54"
cellpadding="3"
cellspacing="2"
summary="">
<TR style="color : black">
<TD style="background : #CEDAEB">
P
</TD>
<TD style="background : #CEDAEB">
#
</TD>
<TD style="background : #CEDAEB">
DRIVER
</TD>
<TD style="background : #CEDAEB">
TIME
</TD>
</TR>
<TR style="color : black">
<TD style="background : #CEDAEB">
1
</TD>
<TD style="background : #CEDAEB">
48
</TD>
<TD style="background : #CEDAEB">
t henry
</TD>
<TD style="background : #CEDAEB">
--
</TD>
<TR style="color : black">
<TD style="background : #CEDAEB">
2
</TD>
<TD style="background : #CEDAEB">
38
</TD>
<TD style="background : #CEDAEB">
B Elder
</TD>
<TD style="background : #CEDAEB">
--
</TD>
<TR style="color : black">
<TD style="background : #CEDAEB">
3
</TD>
<TD style="background : #CEDAEB">
25
</TD>
<TD style="background : #CEDAEB">
J Ahlin
</TD>
<TD style="background : #CEDAEB">
--
</TD>
<TR style="color : black">
<TD style="background : #CEDAEB">
4
</TD>
<?php
$a = file('yourfile.html');
$a = implode($a, "\r\n");
preg_match_all('/<td style=\"([a-z0-9\:\;\# ]+)\">(.*)?<\/td>/i', $a, $match);
echo('<pre>'.print_r($match[2], true).'</pre>');
?>
Array
(
[0] => P
[1] => #
[2] => DRIVER
[3] => TIME
[4] => 1
[5] => 48
[6] => t henry
[7] => --
[8] => 2
[9] => 38
[10] => B Elder
[11] => --
[12] => 3
[13] => 25
[14] => J Ahlin
[15] => --
[16] => 4
)
BeKustom said:Thanks man. That works but now my question is how can I pull the data from the other 3 tables in the same file?
<table>
<!-- first data -->
</table>
<table>
<!-- second data -->
</table>
<table>
<!-- third data -->
</table>
<?xml version="1.0" encoding="UTF-8" ?>
foreach($file as $line) {
if(strpos($line, '<table>') {
// save this data to an array
}
if(strpos($line, '</table>') {
// iterate to the next array
}
}
