Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aide api GET /main/api/v2/mining/rig2/{rigId} #50

Closed
mickael59 opened this issue Mar 10, 2022 · 4 comments
Closed

aide api GET /main/api/v2/mining/rig2/{rigId} #50

mickael59 opened this issue Mar 10, 2022 · 4 comments

Comments

@mickael59
Copy link

pouvais vous m'aider a mettre en place le coter php

@bl4z
Copy link
Collaborator

bl4z commented Mar 10, 2022

#4

@bl4z bl4z closed this as completed Mar 10, 2022
@mickael59
Copy link
Author

code php de api GET /main/api/v2/mining/rig2/{rigId} merci

@mickael59
Copy link
Author

//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);

@mickael59
Copy link
Author

sa fonctione pas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants