För den som tvekar på mina uppgifter, så postar jag min "tickers" kod här:
Kod:
<?php
require_once('Cache/Lite.php');
$id = 'bitst';
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => 120
);
$Cache_Lite = new Cache_Lite($options);
// Get USD / SEK Price Ratio
ob_start();
require 'dollarprice.php';
$usd = ob_get_clean();
function getPrice() {
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($c, CURLOPT_URL, 'https://www.bitstamp.net/api/ticker/');
$data = curl_exec($c);
curl_close($c);
return $data;
}
if ($data = $Cache_Lite->get($id)) {
} else {
$data = getPrice();
$Cache_Lite->save($data);
}
$obj = json_decode($data);
$sell = $obj->{'ask'};
$buy = $obj->{'bid'};
$tempbuy = ($buy * $usd) - (($buy * $usd) * 0.02);
?>