-
Notifications
You must be signed in to change notification settings - Fork 0
/
currencies.php
29 lines (23 loc) · 1.27 KB
/
currencies.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
$jsonCSC = file_get_contents('http://csc.blockexp.info/ext/summary');
$dataCSC = json_decode($jsonCSC,true);
$priceCSC = $dataCSC["data"][0]["lastPrice"];
$priceCSC = number_format($priceCSC, 8);
$jsonBTC = file_get_contents('https://api.coindesk.com/v1/bpi/currentprice.json');
$dataBTC = json_decode($jsonBTC,true);
$priceBTC = $priceCSC * $dataBTC["bpi"]["USD"]["rate_float"];
$jsonGBP = file_get_contents('https://api.coindesk.com/v1/bpi/currentprice.json');
$dataGBP = json_decode($jsonGBP,true);
$priceGBP = ($priceCSC * $dataGBP["bpi"]["GBP"]["rate_float"]);
$jsonEUR = file_get_contents('https://api.coindesk.com/v1/bpi/currentprice.json');
$dataEUR = json_decode($jsonEUR,true);
$priceEUR = ($priceCSC * $dataEUR["bpi"]["EUR"]["rate_float"]);
$jsonCNY = file_get_contents('https://api.coindesk.com/v1/bpi/currentprice/CNY.json');
$dataCNY = json_decode($jsonCNY,true);
$priceCNY = ($priceCSC * $dataCNY["bpi"]["CNY"]["rate_float"]);
echo "<li><a href=''>" . $priceCSC . " BTC</a></li>" .
"<li><a href=''>" . round($priceBTC, 5) . " USD </a></li>".
"<li><a href=''>" . round($priceGBP, 5) . " GBP </a></li>".
"<li><a href=''>" . round($priceEUR, 5) . " EUR </a></li>".
"<li><a href=''>" . round($priceCNY, 5) . " CNY </a></li>";
?>