getting data from a HTML table
| From: | Christopher J. Crane | Date: | Tue, 25 Feb 2003 15:22:39 +0000 |
| Subject: | getting data from a HTML table | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-137075@lists.php.net to get a copy of this message | ||
I use a website to get data that I would like with the following code:
<!--- code start --->
function StockLookup($company) {
$LookupUrl = "http://quote.yahoo.com/l?s=$company";
$Results = implode('', file("$LookupUrl"));
list($split1, $split2) = split('<!--- Background table--->', $Results);
list($Final, $split3) = split('<!--- End of Background Table --->',
$split2);
print "$Final\n";
}
<!--- code end --->
The problem is that I get the HTML left after splitting up the page is in a
HTML table. The table has some columns and rows I do not want. What is the
easiest way to extract the data I want. The table contains 5 columns, but I
only want the first 4.