我下面的代码不起作用,我基本上想要显示帐户余额,我使用var_dum($curl_response)来实际查看代码停止的位置,因为如果我转储最终结果,我会得到null。
<?php
$headers = array ( "Content-Type: application/json" );
$service_url = 'https://api.hitbtc.com/api/2/trading/balance';
$curl = curl_init($service_url);
curl_setopt ($curl, CURLOPT_HTTPHEADER, $headers );
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "xxxx:xxx"); //Your credentials goes here
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //IMP if the url has https and you don't want to verify source certificate
$curl_response = curl_exec($curl);
$response = json_decode($curl_response);
curl_close($curl);
var_dump($curl_response);
?>发布于 2019-11-18 00:41:06
对于那些来这里寻找答案的人,我自己修复了它,这是为了帮助你,这是真正使用HitBTC的方式,而不需要他们的SDK。
<?php
$ch = curl_init('https://api.hitbtc.com/api/2/trading/balance'); curl_setopt($ch, CURLOPT_USERPWD, 'xxxx:xxxxx'); // API AND KEY
$return = curl_exec($ch); curl_close($ch); print_r($return); ?>https://stackoverflow.com/questions/58901467
复制相似问题