0

Possible Duplicate:
How to parse and process HTML with PHP?

I want to get the contents of a remote website using file_get_contents() This website has texts, images and a table in which i am interested. There is the next table on that remote site:

<table style="width: 100%" class="style36">
    <tr>
        <td style="width: 25%" class="style38">B3</td>
        <td style="width: 60%" class="style38">Las Flores</td>
        <td style="width: 15%" class="style38">0</td>
    </tr>
</table>

The values on each cell are dynamic, and I would like to query them in the fastest and more reliable way possible.

I tried limiting the file_get_contents function to read only from X characters, but since the page is dynamic, I can not really know on which character my table starts.

Thanks in advance

Community
  • 1
  • 1
Karevan
  • 139
  • 1
  • 16

2 Answers2

0

I would suggest using curl instead.

Once you have the page's output, you can use a variety of tools to parse the content. Google will be your friend here, especially if you want to find a PHP HTML parser.

PHP has a ton of DOM functions at its disposal, so you could also roll your own.

Brendan
  • 4,565
  • 1
  • 24
  • 39
0

You'll want to take a look at a concept call scraping; there are web scraping libraries available or you can you use preg_match_all() to get the elements you require with regular expressions. Scraping Library for PHP - phpQuery? check out that link.

Community
  • 1
  • 1
frosty
  • 769
  • 6
  • 18