0
は:1次元データを読み込みBittrexのAPI - PHP JSONデコード私はbittrex口座の残高を取得して問題を抱えている
{
"success":true,
"message":"",
"result":[
{
"Currency":"ADA",
"Balance":1800.00000000,
"Available":1800.00000000,
"Pending":0.00000000,
"CryptoAddress":null
},
{
"Currency":"ARK",
"Balance":0.00000000,
"Available":0.00000000,
"Pending":0.00000000,
"CryptoAddress":null
},
{
"Currency":"BTC",
"Balance":0.00007135,
"Available":0.00007135,
"Pending":0.00000000,
"CryptoAddress":"XXX"
}
]
}
が、それは動作します:
$apikey='Removed';
$apisecret='Removed';
$nonce=time();
$uri='https://bittrex.com/api/v1.1/account/getbalances?apikey='.$apikey.'&nonce='.$nonce;
$sign=hash_hmac('sha512',$uri,$apisecret);
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$sign));
$execResult = curl_exec($ch);
$data=file_get_contents($execResult);
$json=json_decode($data);
$result=$json->result;
foreach($result as $i => $object){
echo $object->Balance,'<br />';
}
それだけで以下のJSONを提供します詳細:
$btrxprice ="https://bittrex.com/api/v1.1/public/getticker?market=BTC-ETH";
$fgc = json_decode(file_get_contents($btrxprice), true);
$bidprice = $fgc["result"]["Bid"];
私の問題はどこですか?私は1鉱石のバランスをとるように努力しています。
私はあなたが何を求めているのか分かりません。 JSONはあなたが期待したものではありませんか?あなたのプログラムの出力はあなたが期待したものではありませんか?今何が起こっているのか、何が欲しいのですか? – smarx
残高を印刷したいと思います。私はJSONを望んでいない、私は値が必要です。ありがとう! –
そして...あなたのコードはそれをしませんか? – smarx