【发布时间】:2022-11-30 03:53:15
【问题描述】:
我正在尝试将 binance api 与 php 集成。 我想花掉我的现货钱包和收入。 我找不到我需要的 url,也找不到端点。
附加问题:我需要时间戳干什么?
$secret = "mySecretKey";
$key = "myApiKey";
$s_time = "timestamp=".time()*1000;
$sign=hash_hmac('SHA256', $s_time, $secret);
$url = "https://api.binance.com/api/v1/balances?".$s_time.'&signature='.$sign;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-MBX-APIKEY:'.$key));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
$result = json_decode($result, true);
echo '<pre>';
var_dump($result);
echo '</pre>';
curl_close($ch);
我尝试了很多网址并查看了 binance documentation 很长时间,但我就是找不到。
谢谢你的帮助!
【问题讨论】: