How to parse this table and extract data from it?
<p>I have the following table: <a href="http://www.nbs.rs/kursnaListaModul/srednjiKurs.faces?lang=lat" rel="nofollow">http://www.nbs.rs/kursnaListaModul/srednjiKurs.faces?lang=lat</a></p>

<p>It is a currency exchange list and I need to extract some data from it. On left side of the table are currency ID numbers. Would it be possible to extract data from specified rows based on their IDs?</p>

<p>For example, from the table above, I want to extract currencies with IDs 978, 203, and 348.</p>

<p>Output should be:</p>

<ul>
<li>EUR 104,2182</li>
<li>CZK 4,2747</li>
<li>HUF 38,7919</li>
</ul>

<p>By looking at similar examples here, I came up with this: <a href="http://pastebin.com/hFZs1H7C" rel="nofollow">http://pastebin.com/hFZs1H7C</a></p>

<p>I need somehow to detect IDs and the print proper values... I'm noob when it comes to programming and I need your help.</p>

<pre><code>&lt;?php
$data = file_get_contents('http://www.nbs.rs/kursnaListaModul/srednjiKurs.faces?lang=lat');

$dom = new domDocument;

@$dom-&gt;loadHTML($data);
$dom-&gt;preserveWhiteSpace = false;
$tables = $dom-&gt;getElementsByTagName('table');

$rows = $tables-&gt;item(1)-&gt;getElementsByTagName('tr');

foreach ($rows as $row) {
        $cols = $row-&gt;getElementsByTagName('td');
                foreach ($cols as $col) {

                                echo $col;

                }
}

?&gt;
</code></pre>
