比特币交易量代码 API 错误 [PHP]

Bitcoin Exchange Volume Ticker API Error [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"]

?>

这是怎么回事?

检查您的错误日志。可能出现超时或其他错误。

日志的位置取决于您的 OS and/or 服务器。如果您在 Ubuntu 环境中使用 Apache,您很可能会在 /var/log/apache/error.log 下找到日志。在控制台做tail -f /var/log/apache/error.log,刷新页面看看有没有写的东西。