我正在尝试使用PHP curl连接到Bitpanda网站来检索我的加密资产。
不幸的是,它不工作,我添加了一个Powershell脚本,工程,我希望有人能把它翻译成PHP...
我收到以下错误消息:
{"errors":[{"status":401,"code":"unauthorized","title":"Credentials\/Access token wrong"}]}
下面是来自Bitpanda的例子:
curl -X GET "https://api.bitpanda.com/v1/trades" \
-H "X-API-KEY: string"
如果解决方案是JavaScript的,那对我来说就足够了:)
先谢谢你
php不工作:
$service_url = "https://api.bitpanda.com/v1/trades";
$curl_session = curl_init($service_url);
curl_setopt($curl_session, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl_session, CURLOPT_HTTPHEADER, ['content-type: application/json']);
curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl_session);
curl_close($curl_session);
echo $result;
powershell的工作原理:
$key = "APIKEY"
$trades = Invoke-WebRequest -Uri "https://api.bitpanda.com/v1/trades" -Headers @{"X-API-KEY" = $key} -UseBasicParsing
$tdata = $trades.Content | ConvertFrom-Json
$tdata.data.attributes | Out-GridView
1条答案
按热度按时间3df52oht1#
试试看: