aide api GET /main/api/v2/mining/rig2/{rigId}
Closed this issue · 4 comments
pouvais vous m'aider a mettre en place le coter php
code php de api GET /main/api/v2/mining/rig2/{rigId} merci
//get current time
$curl = curl_init();
//curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url_root."/api/v2/time");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
$time = json_decode($result, true)['serverTime'];
echo "server time: ".$time."\n";
//do auth request
$nonce = uniqid();
$path = "/main/api/v2/mining/rig2/";
$signature = $api_key."\x00".$time."\x00".$nonce."\x00"."\x00".$org_id."\x00"."\x00"."GET"."\x00".$path."\x00";
$signhash = hash_hmac('sha256', $signature, $api_secret);
$headers = array(
"X-Time: {$time}",
"X-Nonce: {$nonce}",
"X-Organization-Id: {$org_id}",
"X-Request-Id: {$nonce}",
"X-Auth: {$api_key}:{$signhash}",
);
$curl = curl_init();
//curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url_root.$path.$id_rig);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
$info = json_decode($result, true);
print_r($info);
sa fonctione pas