2015-10-13 78 views
0

我想从几个交易所获得交易量。当我加载这个东西时除了空白页面之外什么都不加载也许我错过了一个小错误?比特币交易量股票代码API错误[PHP]

<?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"] 

?> 

发生了什么事?

回答

1

检查你的错误日志。可能有超时或其他错误。

日志所在的位置取决于您的操作系统和/或服务器。如果您在Ubuntu环境中使用Apache,您会发现最有可能在/var/log/apache/error.log下的日志。在控制台中执行tail -f /var/log/apache/error.log,刷新页面并查看是否有写入内容。

+0

好的,我会尽力找到它们。 – Darkstar

+0

您正在使用哪种操作系统和服务器? – messy

+0

14.04上的Ubuntu LAMP – Darkstar