1
如何從JSON url https://api.coinmarketcap.com/v1/ticker/ethereum/獲取變量「price_usd」和「price_btc」?我寫了一個腳本,但沒有任何反應。如何使用PHP來獲取和解碼JSON數據?
<?php
$tick = file_get_contents('https://api.coinmarketcap.com/v1/ticker/ethereum/');
$url = $tick;
$json = file_get_contents($url);
$data = json_decode($json, TRUE);
$usd = $data[0]["price_usd"];
echo $usd;
?>
'的print_r($數據);' – AbraCadaver