API 参数无效

Invalid API parameters

当我仅将 "info" 设置为方法程序 运行 的参数时,我创建了对象调用 API,没有任何错误。当我像这样设置参数时 ("swapList",$t) 我得到 {"error":407,"errorMsg":"Invalid value: currency","time":1476023664,"limit":{"used":5,"allowed":600,"expires":1476024000}}。我尝试了很多在那里设置的数组,但结果是一样的。这是 API 文档 https://github.com/bitmarket-net/api

这是我的代码

<html>
<body>
<?php
class API
{
public function bitmarket_api($method, $params = array())
{
    $key = "XXXXXXXXXXXXXXXXXXXXX";
    $secret = "XXXXXXXXXXXXXXXXXXXX";

    $params["method"] = $method;
    $params["tonce"] = time();

    $post = http_build_query($params, "", "&");
    $sign = hash_hmac("sha512", $post, $secret);
    $headers = array(
        "API-Key: " . $key,
        "API-Hash: ". $sign,
    );

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_URL, "https://www.bitmarket.pl/api2/");  
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    $ret = curl_exec($curl);
    if ($ret === false)
    {
    die(curl_error($curl));
    }
    echo $ret; 
}
}

$t[]='BTC';
$z =new API;
$z->bitmarket_api('swapList',$t);

?>
</body>
</html>

您传递的参数数组没有键名。

试试:

$t['currency'] = 'BTC';