I'm trying to get some exchange rates from another website, I'm logging in and grabbing all the data with file_get_contents, this is what I use:
$username = 'myusername@gmail.com';
$password = 'mypassword';
$url = 'http://website-i-get-content-from.com';
$context = stream_context_create(array(
'http' => array(
'header' => "Authorization: Basic " . base64_encode("$username:$password")
)
));
$data = file_get_contents($url, false, $context)
?>
Now I only need some parts of that website: the exchange rates for EUR CHF and GBP, in the source code it looks like this:
EUR USD 0.599 USD 0.599
CHF USD 0.470 USD 0.470
GBP USD 0.675 USD 0.675
So 0.599, 0.470 and 0.675 are the numbers I need at this time. They do change obviously.
How do I put them into variables ?
No comments:
Post a Comment