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,7 +63,7 @@ $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;
|
||||
|
||||
|
@ -25,11 +78,28 @@ if(($zeit - $xmrdatas['time']) >= 5){
|
|||
// 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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Werte in die .json gespeichert
|
||||
file_put_contents("coingecko.json", json_encode($new_sort_array));
|
||||
file_put_contents("coingecko.json", json_encode($new_array));
|
||||
file_put_contents("coingecko-original.json", json_encode($new_sort_array));
|
||||
|
||||
// echo "<br/>Sync.<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