2016-12-04 96 views
2

我想弄清楚下面的代码与Coinbase API一起工作会出错。我的Composer安装了Coinbase依赖项。以前,我收到一个错误,指出Coinbase类没有安装,我发现是因为路径。我不再有任何错误,但代码没有执行。谁能帮忙?试图让Coinbase API工作

<?php 
    require_once __DIR__ . '/usr/bin/vendor/autoload.php'; 
    use coinbase\coinbase; 

    //I've tried to run it both with and without the following 3 lines of code with no difference 
    ini_set('display_errors', 1); 
    ini_set('display_startup_errors', 1); 
    error_reporting(E_ALL); 


    $apiKey = 'XXX'; 
    $apiSecret = 'XXX'; 

    $configuration = Configuration::apiKey($apiKey, $apiSecret); 
    $client = Client::create($configuration); 

    $account = $client->getPrimaryAccount(); 
    echo 'Account name: ' . $account->getName() . '<br>'; 
    echo 'Account currency: ' . $account->getCurrency() . '<br>'; 
    ?> 

回答