我是集成的coinbase php(cURL)api,我发现下面的错误。我无法理解这个错误的含义。请帮帮我。
这是我的PHP代码,
$COINBASE_API_KEY = '-------------';
$COINBASE_API_SECRET = '-----------';
$api_url = 'https://api.coinbase.com/v2/';
$curl = curl_init($api_url);
$srvr_time = json_decode(file_get_contents("https://api.coinbase.com/v2/time"), true)["data"]["epoch"];
$method="GET";
$request="accounts";
$Datas = $srvr_time.$method.$request;
$hmacSig = base64_encode(hash_hmac("sha256", $Datas, base64_decode($COINBASE_API_SECRET), true));
curl_setopt($curl,CURLOPT_HTTPHEADER,array(
'Content-Type: application/json',
'CB-ACCESS-KEY: '.$COINBASE_API_KEY,
'CB-ACCESS-TIMESTAMP: '. time(),
'CB-VERSION: 2017-08-07',
'CB-ACCESS-SIGN: '.$hmacSig));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,TRUE);
$response = curl_exec($curl);
curl_close($curl);
$output = json_decode($response, true);
print_r($output);
Api的回应如下。
Array
(
[success] =>
[error] => Scopes don't match current API version.
)
答案 0 :(得分:0)
' CB-VERSION:2017-08-07'
此API版本是否与您在Coinbase中使用应用设置建立的内容相匹配?