2015-10-13 79 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