Parsing Table with PHP Simple HTML DOM Parser
Posted: Sat Feb 28, 2009 12:11 pm
I'll start off by saying that I don't have much experience with php but I am creating an iPhone app and need a way to parse data out of a table on a website and then format it in to a mobile / iPhone optimized site for easier viewing. In researching a way to do this, I found that using PHP Simple HTML DOM Parser looks to be the easiest way. However, being so new to php, I am having a problem setting up the php file to read the contents of the table.
Here is the website with the table I am trying to parse:
http://tinyurl.com/bafm8
Pretty much what I'm wanting to do is format that onto my own website as a simple table without all of the graphics and extra information/links. In following some examples on the sourceforge page linked above, this is what I've tried playing around with so far just to see if I can get the data pulled from the table but it doesn't appear to work at all (blank page).
Any help would be appreciated!
Here is the website with the table I am trying to parse:
http://tinyurl.com/bafm8
Pretty much what I'm wanting to do is format that onto my own website as a simple table without all of the graphics and extra information/links. In following some examples on the sourceforge page linked above, this is what I've tried playing around with so far just to see if I can get the data pulled from the table but it doesn't appear to work at all (blank page).
Code: Select all
<?php
include_once('simple_html_dom.php');
$html = file_get_html('http://www.okstate.com/SportSelect.dbml?DB_OEM_ID=200&KEY=&SPID=143&SPSID=1420');
$es = $html->find('table.odd td')->plaintext;
?>