Page 1 of 1

Read an HTML table

Posted: Mon Sep 25, 2006 12:45 pm
by nates310
Is there any way I can read the html from a page that does not belong to me, say a listing of catalog items and get the values from each cell (by looking for the <Td> tags) and then put that info into a table of my own and display it on my page.

I thought of this because with any browser, you can go to a page and view it's source. You can plainly see where the cells are defined and what not, so is there a way of reading that data using php and then putting it into a table of my own. OR, if I want, even uploading it to my own database?

Posted: Mon Sep 25, 2006 12:55 pm
by volka
If available you can use http://de2.php.net/manual/en/function.d ... mlfile.php
But if you're allowed to read/use the data is another story.

Posted: Mon Sep 25, 2006 1:59 pm
by hawleyjr
It would not be hard to do using file_get_contents or cURL a few loops and regex :)

Posted: Mon Sep 25, 2006 2:45 pm
by Mordred
This is called "scrapping", search for more info.

You can do it by parsing the HTML with a regexp, or with a dom parser, both have pluses and minuses.