| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Apr 2007 Location: South Carolina
Posts: 42
![]() | Parsing HTML 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.
__________________ InsaneCreationz |
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Member Join Date: Apr 2007 Location: South Carolina
Posts: 42
![]() | 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. HTML Code: <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>
__________________ InsaneCreationz |
| |
| | #4 (permalink) |
| i love automation Join Date: Nov 2007 Location: xrvel.com
Posts: 1,620
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Please try this ![]() It works here.. PHP Code: PHP Code:
__________________ |
| |
| | #6 (permalink) | ||||
| i love automation Join Date: Nov 2007 Location: xrvel.com
Posts: 1,620
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
PHP Code: For example unique HTML style which does not applied in other tables or such?
__________________ | ||||
| |
| | THREAD STARTER #7 (permalink) |
| NamePros Member Join Date: Apr 2007 Location: South Carolina
Posts: 42
![]() | 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.
__________________ InsaneCreationz |
| |
| | #8 (permalink) |
| New Member Join Date: Dec 2007 Location: Pune, Maharashtra, India
Posts: 11
![]() | 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" ?> ????: NamePros.com http://www.namepros.com/showthread.php?t=423681 it will be really useful if you do this way.
__________________ Nilesh www.itech7.com |
| |
| | #9 (permalink) |
| New Member Join Date: Feb 2008
Posts: 9
![]() | you could just loop through the file like this: PHP Code: |
| |