Okie dokies, made a little bit progress thanks for the tip.
Ive went down the lines of using eregi.
Im using the REGEX:
(At ([1-9]|1[0-2]):[0-5]0-9 : ([0-9]+).([0-9]+) p)
To match:
At 4:35PM : 104.40 p
However it fails?
Using file_get_contents will it return the source rather than than what is displayed.
<html>
<head>
<title>Stock Quote from Yahoo Finance</title>
</head>
<body>
<?php
$symbol='NRK.L';
$theurl="http://uk.finance.yahoo.com/q?s=$symbol";
if (!($contents = file_get_contents($theurl)))
{ echo 'Invalid URL'; exit; }
//At 4:35PM : 104.40 p
// At 4:35PM :</small><big><b>104.40 p In source
$pattern = '(At ([1-9]|1[0-2]):[0-5][0-9]([AP]M) : ([0-9]+)\.([0-9]+) p)';
if (eregi($pattern, $contents, $quote))
{
echo "<p>";
echo "$quote[1] $symbol";
echo '</p>';
}
else
{
echo '<p>No quote available</p>';
};
?>
</body>
</html>
Basically im trying to return the price and time of shares retreived from just underneath the input box's at the top.
it looks something like...
NORTHERN ROCK (NRK.L) At 4:35PM : 104.40 p 5.10 (4.66%)
http://uk.finance.yahoo.com/q?s=nrk.l
If I break down the regex it works. So I can return the time then the price. But idealy i want it in the same statment so I know im getting it from the right place incase of an error in the future if the structure or someother data meets the requirements.
Any ideas what may be wrong?
Thanks, greatly apriciated.
First time I have had to do something like this, just for personal benefit.