Sugapablo wrote:[color=blue]
> Before I go building this, I want to know if it already exists.
>
> I need some PHP code that will read a web page and return all text that
> comes between <td></td> tags in an array.
>
> So if there were three tables on that page, it would return the first
> table's fourth row, third column in a variable such as:
>
> $tableArray[0][3][1]
> // ^ ^ ^ - 2nd <td></td>
> // ^ ^ - 4th <tr></tr>
> // ^ - 1st <table></table>
>
> Does something like this exist somewhere where I can grab it, or do I have
> to build it from scratch?[/color]
I just recently posted a routine that gets all <input>s from within
<form>s. This tiny URL fetches it from the Google archive:
http://tinyurl.com/3629k
You just have to change it to fetch all <table>s, and all <tr>s from
each table, then all <td>s (maybe <th>s too?) from each <tr>.
Something like
preg_match_all($table_regexp, $html, $tables);
foreach ($tables as $table) {
preg_match_all($tr_regexp, $table_html, $trs);
foreach ($trs as $tr) {
preg_match_all($tr_regexp, $tr_html, $tds);
}
}
Happy Coding :)
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--