Im currently trying to match the source code of the url linked below.
Im reading off the stock value at yahooofinance and the last trade time. However my statement alough it is correct wont return any results.
I am trying to match:
<small>At 4:35PM </small><big><b>86.00 p
With:
((At|On)\s([1-9]|1[0-2]):([0-5][0-9])([AP]M)\s\s\s</small><big><b>([0-9]+).([0-9]+)\sp)
Which is correct.
However it fails to find a result. My full source is:
<?php
$symbol='NRK.L';
$theurl="http://uk.finance.yahoo.com/q?s=$symbol";
if (!($contents = file_get_contents($theurl)))
{ echo 'Invalid URL'; exit; }
$pattern = '((At|On)\s([1-9]|1[0-2]):([0-5][0-9])([AP]M)\s\s\s<small><big><b>([0-9]+).([0-9]+)\sp)';
if (eregi($pattern, $contents, $quote))
{
echo "<p>";
echo "$quote[1] $symbol";
echo '</p>';
}
else
{
echo '<p>No quote available</p>';
};?>
Any Ideas where I am going wrong? Ive been scratching my head for a while on this one! Ive even used REGEX Coach to double check my regex statment and it works fine! So Im clueless!😕
Thanks again, Jamie.