0

In localhost everything working fine . But in live server its breaking at a fatal error and not executing further.

    /* ======== API CONFIG ========== */
require __DIR__.'/dev_components/wallet_api_components/vendor/autoload.php';
use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;
use Coinbase\Wallet\Resource\Account;
use Coinbase\Wallet\Resource\Address;
use Coinbase\Wallet\Resource\Transaction;
use Katzgrau\KLogger\Logger;
/* Settings */
$apiKey = "XXXXXXXXXX";
$apiSecret = "YYYYYYYYYYYYYYY";
$configuration = Configuration::apiKey($apiKey, $apiSecret);
$logger = new Logger(__DIR__.'/errorlog', Psr\Log\LogLevel::WARNING, array (
    'logFormat' => '{date} - {level} - {message}',
    'filename'  => 'error_log',
    'extension' => 'txt'
));
$logger->info('INFO message');
$configuration->setLogger($logger);
$client = Client::create($configuration);
// I have used print_r($configuration) ; print_r($client) to check the full 
//configuration and client object and in both localhost and Live server its 
//showing same data


$account_btc = $client->getAccount('BTC'); // From this line nothing executing
$account_eth = $client->getAccount('ETH');

the Error is

stderr: PHP Catchable fatal error: Argument 1 passed to Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface, null given, called in /path/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 33 and defined in /path/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 98

What is the reason behind getting the above fatal error in Live Server and how to get rid of this ?

4

2 回答 2

2

我在设置 coinbase api 时也收到了这个错误。此错误是由于 ssl 证书引起的,因此我从https://curl.se/docs/caextract.html下载了 cacert.pem 文件并将其放在 etc 文件夹中。之后,我将第 58 行“$this->caBundle = DIR .'/../etc/ca-coinbase.crt'”的“src/Configuration.php”中的顶点名称更改为“$this->caBundle = DIR ” .'/../etc/cacert.pem'”。因此我的错误解决了。

于 2021-02-08T06:09:22.737 回答
0

我假设您没有发布整个错误转储,但查看您的错误:stderr: PHP Catchable fatal error: Argument 1 passed to Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface

这意味着当调用 HTTPException:exceptionClass() 时,您必须使用参数中的 ResponseInterface 对象来调用它。

如果上述内容不能解决您的问题,请发布整个错误转储。如果您不发布整个错误转储,则很难知道根本原因。

于 2018-02-19T02:49:47.973 回答