未捕获的错误:类ApiKeyAuthentication

时间:2017-01-19 18:51:23

标签: php coinbase-api coinbase-php

我正在尝试使用coinbase的官方PHP API,但我在使用以下代码时面临问题:

<?php
require_once('coinbase/Client.php');
require_once('coinbase/Configuration.php');

use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;
$apiKey = "c9549b4603e1213bcfde15794a733659393c075280c4039568b675af120a9862";
$apiSecret = "e32f781fa5351815e174b97ea71691b3c7f01be624af6d96eb107dff088b1cb8";

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

在尝试上面的代码时,我会在Apache Logs中得到以下内容:

[Fri Jan 20 00:12:59.460967 2017] [:error] [pid 25211] [client 127.0.0.1:34742] PHP Fatal error:  Uncaught Error: Class 'Coinbase\\Wallet\\Authentication\\ApiKeyAuthentication' not found in /var/www/test/coin/src/Configuration.php:49\nStack trace:\n#0 /var/www/test/coin/index.php(10): Coinbase\\Wallet\\Configuration::apiKey('c9549b4603e1213...', 'e32f781fa535181...')\n#1 {main}\n  thrown in /var/www/test/coin/src/Configuration.php on line 49, referer: http://localhost/test/

1 个答案:

答案 0 :(得分:0)

还需要ApiKeyAuthentication文件。根据我的项目,它位于Authentication文件夹中。

<?php
    require_once('coinbase/Client.php');
    require_once('coinbase/Configuration.php');
    require_once('Authentication/ApiKeyAuthentication.php');
.
.
.
//Your project code