I am parsing a html page and i want certain value which changes at regular interval. But i dont know how to achieve it.
<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>
I need the value of 1g 22 karat today and 24 karat today. My Code
$regex='/<table class="priceTable">
<tbody><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>(^[a-zA-Z0-9_.-]*$)<\/td>/';
//$regex='/<tr>
// <td>MUMBAI<br><br><a class="highlightlink" href="http:\/\/mumbai.indiagoldrate.com">Gold Rates in <br>Mumbai - More Info & archives<\/a>
//
// <br><br><!-- <A class="highlightlink" HREF="mumbai-gold-rate-on-2015-08-03.htm">Gold & Silver Rates in <BR>Mumbai - on 3-Aug-2015<\/A> -->
// <\/td>
// <td><table class="innerTable">
// <tbody><tr>
// <td>([\w\W]*?)<\/td>/';
preg_match($regex,$data,$match);
$line = $match[0];
echo $line;
echo '<br/>';
Error: Undefined Offset. please help me