I am looking for some advice on how to parse table data from a HTML file and store it in a mySQL database. The HTML file has 4 different tables that I need info from. Any help on this would be greatly appreciated. I can provide more detailed information if needed.
The views expressed on this page by users and staff are their own, not those of NamePros.
Alright here is an example of the tables. They are all laid out the same way as this one just with different data in the td tags. The code below isn't the entire table just a portion of it, hopefully you get the idea.
No there isn't and I sent you a PM. That was my biggest problem before when I attempted this for about 2 weeks straight. I know it can be done because a few sites related to this game do it.
If the server you are using supports PHP 5 and has the XML extension SimpleXML installed then use it. You have to just add this line at the top of you html file to make it as XHTML
Code:
<?xml version="1.0" encoding="UTF-8" ?>
then use simplexml to get tagwise data. see the manual of simplexml here- www.php.net/simplexml
foreach($file as $line) {
if(strpos($line, '<table>') {
// save this data to an array
}
if(strpos($line, '</table>') {
// iterate to the next array
}
}
then loop you new array with the preg match that was given above...