2016-12-04 75 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>'; 
    ?> 

回答