0
あなたの誰かが間違っていることを教えてくれますか? APIドキュメント(https://github.com/bitmarket-net/api)のサンプルコードを使用します。 JSONは何も返しません。 echo bitmarket_api("info");
を追加し、公開鍵と秘密鍵($key
$secret
)を置き換えます。API、JSONは何も返さない
<html>
<body>
<?php
function bitmarket_api($method, $params = array())
{
$key = "xxxxxxxxx";
$secret = "xxxxxxxxx";
$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);
return json_decode($ret);
}
echo bitmarket_api("info"); // line 30
?>
</body>
</html>
編集 は、後にtrueを返しSSLの問題の機能を解決し、私はエラー を持っている "キャッチできる致命的なエラー:クラスはstdClassのオブジェクトは、Cの文字列に変換することができませんでした:\ xamppの\ htdocsに\ index1.phpライン上30 '
edit 解決済み。私は、新しいオブジェクトを作成し、助けをmetod.Thankにあなたのすべてをエコーを追加:)
を返された場合は、チェックするためにわざわざしていないが表示されます失敗。 curl_execは失敗した場合はブール値falseを返し、ヒットしたURLの出力は返しません。ブール値falseは有効なjsonではないので、デコードからもfalseが返され、ブール値falseはゼロ長/不可視文字列として出力されます。 'if($ ret === false){die(curl_error($ curl));}と' die(json_last_error()) '型のもの –