<?php

$html = <<<DOM
<table class="priceTable">
<tr>
    <th colspan="3">Generic Gold Price By Carat/Karat - Today  - Today <br>
    Mon, Aug 3rd, 2015<br>Gold Price Today Per Gram - Current Gold Price in Indian Rupees</th>
</tr>

<tr>    
    <th>22 Karat Today</th>
    <th>22 Karat Yesterday</th> 
    <th>Price Change</th>   

</tr>
<tr>    
    <td>1g = Rs. 2377.00</td>
    <td>1g = Rs. 2377.00</td>   
    <td>

            0       <img SRC="images/green.gif"  alt="India Gold Rate Price Difference Today">
        </td>   
</tr>
<tr>    
    <th>24 Karat (Pure Gold) Today</th>
    <th>24 Karat (Pure Gold) Yesterday</th> 
    <th>Price Change</th>   
</tr>
<tr>    
    <td>1g = Rs. 2541.00</td>
    <td>1g = Rs. 2541.00</td>   
    <td>
            0       <img SRC="images/green.gif" alt="India Gold Rate Price Difference Today">
        </td>   
</tr>
</table>
DOM;

$dom = new DOMDocument('1.0', 'UTF-8');
$dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);

$xpath = new DOMXPath($dom);
$tds = $xpath->query("//table[@class='priceTable']/tr/td[1]");//th[contains(., 'Karat')]

foreach($tds as $td) { 
   echo $td->nodeValue . "\n";
}


