我的 PHP 脚本有问题,该脚本以前可以正常工作。我不知道它为什么停止工作,因为我没有任何改变。
我收到错误消息:
array(2) { ["code"]=> int(-1131) ["msg"]=> string(37) "'recvWindow' 必须小于 60000。" }
所以我确实认为很容易,我只会将设置“recvWindow”设置为小于“60000”,但是接下来的错误消息也会出现在“recvWindow”中
array(2) { ["code"]=> int(-1021) ["msg"]=> string(56) "此请求的时间戳在 recvWindow 之外。" }
那么我必须做些什么才能让它再次工作有什么问题呢?这是我拥有的完整脚本:
<?php
//--API Call
$nonce=time();
//--
$url='recvWindow=10000000000000000×tamp='.$nonce;
//--
$sign=hash_hmac('SHA256',$url,$apisecret);
$url=$url.'&signature='.$sign;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-MBX-APIKEY:'.$apikey));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, "https://api.binance.com/api/v3/account?".$url);
$execResult = curl_exec($ch);
$Balances = json_decode($execResult, true);
var_dump($Balances);
?>