I am trying to use Blockchain.info Ticker API (https://blockchain.info/ticker) to get current BTC price in USD.
The interesting thing is that script not every time returns the same value. When you visit this page directly, none of the values never changes (well just every 15mins) https://blockchain.info/ticker, but on the script it changes on every nth refresh of the page.
Something similar happens if you go to blockchain.info/ticker? with at least a question mark added. Just refresh it a lot and you will see.
Why this is happening and how to get a stable price every 15mins as their API should provide it?
The script I use:
$api = "https://blockchain.info/ticker";
$json = file_get_contents($api);
$data = json_decode($json, TRUE);
$rate = $data["USD"]["sell"];
echo $rate;