【发布时间】:2015-10-13 16:47:21
【问题描述】:
我正在尝试从几个交易所获取交易量。当我加载这个时,除了空白页之外什么都没有加载。也许我错过了一个小错误?
<?php
function getData($url) {
$decode = file_get_contents($url);
return json_decode($decode, true);
}
//BTC Volume on BTCE
$BTCVolumeBTCE = getData('https://btc-e.com/api/3/ticker/btc_usd');
$BTCEVolume = $BTCVolumeBTCE["btc_usd"]["vol_cur"];
//BTC Volume on Bitstamp
$BTCVolumeStamp = getData('https://www.bitstamp.net/api/ticker/');
$StampVolume = $BTCVolumeStamp["volume"];
//BTC Volume on OKCoin
$BTCVolumeOK = getData('https://www.okcoin.com/api/ticker.do?ok=1')
$OKCoinVolume = $BTCVolumeOK["vol"];
//BTC Volume Bitfinex
$BTCVolumeFinex = getData('https://api.bitfinex.com/v1/pubticker/btcusd');
$FinexVolume = $BTCVolumeFinex["volume"]
//BTC Volume LakeBTC
$BTCVolumeLake = getData('https://www.lakebtc.com/api_v1/ticker');
$LakeVolume = $BTCVolumeLake["USD"]["volume"]
?>
发生了什么事?
【问题讨论】: