mirror of
https://github.com/rottenwheel/moner.ooo.git
synced 2024-11-10 05:03:44 +01:00
Update coingecko.php
Remove old API, code formatted
This commit is contained in:
parent
cfa8c81a51
commit
dc42ceebd6
@ -10,35 +10,31 @@ $xmrdatas = json_decode(file_get_contents("coingecko.json"), true);
|
||||
// Liefert den aktuellen Unix-Zeitstempel
|
||||
$zeit = time();
|
||||
|
||||
// Sind ~30 Minuten vergangen?
|
||||
// Sind 5 Sekunden vergangen?
|
||||
if(($zeit - $xmrdatas['time']) >= 5){
|
||||
//echo "Gespeicherte Zeit: ".$xmrdatas['time']."<br/>Aktuelle Zeit: ".$zeit;
|
||||
|
||||
// API key
|
||||
//$access_key = 'xxx';
|
||||
//echo "Gespeicherte Zeit: ".$xmrdatas['time']."<br/>Aktuelle Zeit: ".$zeit;
|
||||
|
||||
// Initialize CURL
|
||||
//$ch = curl_init('https://min-api.cryptocompare.com/data/price?api_key='.$access_key.'&fsym=XMR&tsyms=BTC,USDT,ETH,USD,EUR,LTC,BCH,GBP,DOGE,USDC,DASH,CNY,BNB,RUB,UAH,KRW,TUSD,DAI,JPY,WAVES,INR,BUSD,BRL,PLN,UNO,FTC,NZDT,DOTC,EOS,HITBITC,EURS,SAI,EURN,BNT,NANO,XLM,XRP,KNC,ZEC,OMG,BITUSD,BITCNY,BTS,RUR,QC,XQR,TRY,CHFT,CHF,SGD,HKD,PAX,AED,MYR,CAD,AUD,IDR,ZAR');
|
||||
$ch = curl_init('https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=btc%2Ceth%2Cltc%2Cbch%2Cbnb%2Ceos%2Cxrp%2Cxlm%2Clink%2Cdot%2Cyfi%2Cusd%2Caed%2Cars%2Caud%2Cbdt%2Cbhd%2Cbmd%2Cbrl%2Ccad%2Cchf%2Cclp%2Ccny%2Cczk%2Cdkk%2Ceur%2Cgbp%2Chkd%2Chuf%2Cidr%2Cils%2Cinr%2Cjpy%2Ckrw%2Ckwd%2Clkr%2Cmmk%2Cmxn%2Cmyr%2Cngn%2Cnok%2Cnzd%2Cphp%2Cpkr%2Cpln%2Crub%2Csar%2Csek%2Csgd%2Cthb%2Ctry%2Ctwd%2Cuah%2Cvef%2Cvnd%2Czar%2Cxdr%2Cxag%2Cxau%2Cbits%2Csats&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true&include_last_updated_at=true');
|
||||
$ch = curl_init('https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=btc%2Ceth%2Cltc%2Cbch%2Cbnb%2Ceos%2Cxrp%2Cxlm%2Clink%2Cdot%2Cyfi%2Cusd%2Caed%2Cars%2Caud%2Cbdt%2Cbhd%2Cbmd%2Cbrl%2Ccad%2Cchf%2Cclp%2Ccny%2Cczk%2Cdkk%2Ceur%2Cgbp%2Chkd%2Chuf%2Cidr%2Cils%2Cinr%2Cjpy%2Ckrw%2Ckwd%2Clkr%2Cmmk%2Cmxn%2Cmyr%2Cngn%2Cnok%2Cnzd%2Cphp%2Cpkr%2Cpln%2Crub%2Csar%2Csek%2Csgd%2Cthb%2Ctry%2Ctwd%2Cuah%2Cvef%2Cvnd%2Czar%2Cxdr%2Cxag%2Cxau%2Cbits%2Csats&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true&include_last_updated_at=true');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
// Store the data:
|
||||
$json = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Sortiert/Formatiert die Ausgabe
|
||||
$sort_array = json_decode($json, true);
|
||||
// Sortiert/Formatiert die Ausgabe
|
||||
$sort_array = json_decode($json, true);
|
||||
$new_sort_array = $sort_array['monero'];
|
||||
// Zeit wird ergänzt
|
||||
$new_sort_array['time'] = $zeit;
|
||||
// Zeit wird ergänzt
|
||||
$new_sort_array['time'] = $zeit;
|
||||
|
||||
// Werte in die .json gespeichert
|
||||
// Werte in die .json gespeichert
|
||||
file_put_contents("coingecko.json", json_encode($new_sort_array));
|
||||
|
||||
// echo "<br/>Sync.<hr/>";
|
||||
// echo "<br/>Sync.<hr/>";
|
||||
|
||||
}//else{
|
||||
//echo "Keine Daten, noch zu früh!<br/><br/>";
|
||||
//echo "Gespeicherte Zeit: ".$xmrdatas['time']."<br/>Aktuelle Zeit: ".$zeit."<br/><br/>Differenz: ".$zeit - $xmrdatas['time']."<br/><hr/>";
|
||||
//echo "Gespeicherte Zeit: ".$xmrdatas['time']."<br/>Aktuelle Zeit: ".$zeit."<br/><br/>Differenz: ".$zeit - $xmrdatas['time']."<br/><hr/>";
|
||||
//}
|
||||
?>
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user