mirror of
https://github.com/rottenwheel/moner.ooo.git
synced 2024-12-22 16:17:46 +00:00
use updated coingecko.php
This commit is contained in:
parent
d162e90c7e
commit
75a0632af7
4 changed files with 131 additions and 60 deletions
1
coingecko-original.json
Normal file
1
coingecko-original.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,57 @@
|
|||
<?php
|
||||
$new_array = array();
|
||||
$array = array("EUR",
|
||||
"BTC",
|
||||
"USD",
|
||||
"GBP",
|
||||
"CHF",
|
||||
"RUB",
|
||||
"CNY",
|
||||
"JPY",
|
||||
"IDR",
|
||||
"KRW",
|
||||
"TRY",
|
||||
"AUD",
|
||||
"BMD",
|
||||
"CAD",
|
||||
"HKD",
|
||||
"NZD",
|
||||
"SGD",
|
||||
"TWD",
|
||||
"ILS",
|
||||
"PLN",
|
||||
"ZAR",
|
||||
"CZK",
|
||||
"DKK",
|
||||
"NOK",
|
||||
"SEK",
|
||||
"ARS",
|
||||
"CLP",
|
||||
"PHP",
|
||||
"MXN",
|
||||
"BHD",
|
||||
"KWD",
|
||||
"BRL",
|
||||
"MYR",
|
||||
"VEF",
|
||||
"UAH",
|
||||
"VND",
|
||||
"BDT",
|
||||
"HUF",
|
||||
"MMK",
|
||||
"NGN",
|
||||
"THB",
|
||||
"AED",
|
||||
"SAR",
|
||||
"PKR",
|
||||
"LKR",
|
||||
"INR",
|
||||
"BTC",
|
||||
"LTC",
|
||||
"ETH",
|
||||
"XAG",
|
||||
"XAU");
|
||||
|
||||
//echo "<h1>coingecko.com</h1>";
|
||||
|
||||
// Die Standard-Zeitzone, die verwendet werden soll, setzen.
|
||||
|
@ -10,9 +63,9 @@ $xmrdatas = json_decode(file_get_contents("coingecko.json"), true);
|
|||
// Liefert den aktuellen Unix-Zeitstempel
|
||||
$zeit = time();
|
||||
|
||||
// Sind 5 Sekunden vergangen?
|
||||
// Sind ~30 Minuten vergangen?
|
||||
if(($zeit - $xmrdatas['time']) >= 5){
|
||||
//echo "Gespeicherte Zeit: ".$xmrdatas['time']."<br/>Aktuelle Zeit: ".$zeit;
|
||||
//echo "Gespeicherte Zeit: ".$xmrdatas['time']."<br/>Aktuelle Zeit: ".$zeit;
|
||||
|
||||
// Initialize CURL
|
||||
$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');
|
||||
|
@ -22,19 +75,36 @@ if(($zeit - $xmrdatas['time']) >= 5){
|
|||
$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_array['time'] = $zeit;
|
||||
$new_sort_array['time'] = $zeit;
|
||||
|
||||
// Werte in die .json gespeichert
|
||||
file_put_contents("coingecko.json", json_encode($new_sort_array));
|
||||
foreach ($array as $fiatValue) {
|
||||
$fiatValue = strtolower($fiatValue);
|
||||
if (array_key_exists($fiatValue, $sort_array['monero'])) {
|
||||
$new_array[$fiatValue]['lastValue'] = $sort_array['monero'][$fiatValue];
|
||||
$new_array[$fiatValue]['lastDate'] = $zeit;
|
||||
}else{
|
||||
$new_array[$fiatValue]['lastValue'] = $xmrdatas[$fiatValue]['lastValue'];
|
||||
$new_array[$fiatValue]['lastDate'] = $xmrdatas[$fiatValue]['lastDate'];
|
||||
}
|
||||
//print_r($new_array);
|
||||
}
|
||||
|
||||
// echo "<br/>Sync.<hr/>";
|
||||
|
||||
|
||||
// Werte in die .json gespeichert
|
||||
file_put_contents("coingecko.json", json_encode($new_array));
|
||||
file_put_contents("coingecko-original.json", json_encode($new_sort_array));
|
||||
|
||||
// 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 "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/>";
|
||||
//}
|
||||
?>
|
||||
|
|
100
index.php
100
index.php
|
@ -66,56 +66,56 @@ $time_cg = date("H:i:s", $api_cg->time);
|
|||
$time = $time_cg;
|
||||
|
||||
// Holt die einzelnen Werte für die Berechnung
|
||||
$BTC = $api_cg->btc;
|
||||
$EUR = $api_cg->eur;
|
||||
$USD = $api_cg->usd;
|
||||
$CHF = $api_cg->chf;
|
||||
$LTC = $api_cg->ltc;
|
||||
$CAD = $api_cg->cad;
|
||||
$AUD = $api_cg->aud;
|
||||
$HKD = $api_cg->hkd;
|
||||
$SGD = $api_cg->sgd;
|
||||
$GBP = $api_cg->gbp;
|
||||
$RUB = $api_cg->rub;
|
||||
$ZAR = $api_cg->zar;
|
||||
$TRY = $api_cg->try;
|
||||
$JPY = $api_cg->jpy;
|
||||
$PLN = $api_cg->pln;
|
||||
$INR = $api_cg->inr;
|
||||
$AED = $api_cg->aed;
|
||||
$ETH = $api_cg->eth;
|
||||
$UAH = $api_cg->uah;
|
||||
$KRW = $api_cg->krw;
|
||||
$BRL = $api_cg->brl;
|
||||
$MYR = $api_cg->myr;
|
||||
$CNY = $api_cg->cny;
|
||||
$XAU = $api_cg->xau;
|
||||
$XAG = $api_cg->xag;
|
||||
$VND = $api_cg->vnd;
|
||||
$VEF = $api_cg->vef;
|
||||
$THB = $api_cg->thb;
|
||||
$SAR = $api_cg->sar;
|
||||
$SEK = $api_cg->sek;
|
||||
$PKR = $api_cg->pkr;
|
||||
$NOK = $api_cg->nok;
|
||||
$LKR = $api_cg->lkr;
|
||||
$MMK = $api_cg->mmk;
|
||||
$HUF = $api_cg->huf;
|
||||
$ILS = $api_cg->ils;
|
||||
$KWD = $api_cg->kwd;
|
||||
$NGN = $api_cg->ngn;
|
||||
$NZD = $api_cg->nzd;
|
||||
$PHP = $api_cg->php;
|
||||
$IDR = $api_cg->idr;
|
||||
$TWD = $api_cg->twd;
|
||||
$ARS = $api_cg->ars;
|
||||
$BDT = $api_cg->bdt;
|
||||
$BHD = $api_cg->bhd;
|
||||
$BMD = $api_cg->bmd;
|
||||
$CLP = $api_cg->clp;
|
||||
$CZK = $api_cg->czk;
|
||||
$DKK = $api_cg->dkk;
|
||||
$MXN = $api_cg->mxn;
|
||||
$BTC = $api_cg->btc->lastValue;
|
||||
$EUR = $api_cg->eur->lastValue;
|
||||
$USD = $api_cg->usd->lastValue;
|
||||
$CHF = $api_cg->chf->lastValue;
|
||||
$LTC = $api_cg->ltc->lastValue;
|
||||
$CAD = $api_cg->cad->lastValue;
|
||||
$AUD = $api_cg->aud->lastValue;
|
||||
$HKD = $api_cg->hkd->lastValue;
|
||||
$SGD = $api_cg->sgd->lastValue;
|
||||
$GBP = $api_cg->gbp->lastValue;
|
||||
$RUB = $api_cg->rub->lastValue;
|
||||
$ZAR = $api_cg->zar->lastValue;
|
||||
$TRY = $api_cg->try->lastValue;
|
||||
$JPY = $api_cg->jpy->lastValue;
|
||||
$PLN = $api_cg->pln->lastValue;
|
||||
$INR = $api_cg->inr->lastValue;
|
||||
$AED = $api_cg->aed->lastValue;
|
||||
$ETH = $api_cg->eth->lastValue;
|
||||
$UAH = $api_cg->uah->lastValue;
|
||||
$KRW = $api_cg->krw->lastValue;
|
||||
$BRL = $api_cg->brl->lastValue;
|
||||
$MYR = $api_cg->myr->lastValue;
|
||||
$CNY = $api_cg->cny->lastValue;
|
||||
$XAU = $api_cg->xau->lastValue;
|
||||
$XAG = $api_cg->xag->lastValue;
|
||||
$VND = $api_cg->vnd->lastValue;
|
||||
$VEF = $api_cg->vef->lastValue;
|
||||
$THB = $api_cg->thb->lastValue;
|
||||
$SAR = $api_cg->sar->lastValue;
|
||||
$SEK = $api_cg->sek->lastValue;
|
||||
$PKR = $api_cg->pkr->lastValue;
|
||||
$NOK = $api_cg->nok->lastValue;
|
||||
$LKR = $api_cg->lkr->lastValue;
|
||||
$MMK = $api_cg->mmk->lastValue;
|
||||
$HUF = $api_cg->huf->lastValue;
|
||||
$ILS = $api_cg->ils->lastValue;
|
||||
$KWD = $api_cg->kwd->lastValue;
|
||||
$NGN = $api_cg->ngn->lastValue;
|
||||
$NZD = $api_cg->nzd->lastValue;
|
||||
$PHP = $api_cg->php->lastValue;
|
||||
$IDR = $api_cg->idr->lastValue;
|
||||
$TWD = $api_cg->twd->lastValue;
|
||||
$ARS = $api_cg->ars->lastValue;
|
||||
$BDT = $api_cg->bdt->lastValue;
|
||||
$BHD = $api_cg->bhd->lastValue;
|
||||
$BMD = $api_cg->bmd->lastValue;
|
||||
$CLP = $api_cg->clp->lastValue;
|
||||
$CZK = $api_cg->czk->lastValue;
|
||||
$DKK = $api_cg->dkk->lastValue;
|
||||
$MXN = $api_cg->mxn->lastValue;
|
||||
|
||||
// Lädt die Sprachdatei, nach der Sprache die im Browser eingestellt wurde
|
||||
if(array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)){
|
||||
|
|
Loading…
Reference in a new issue