Created
June 5, 2016 00:22
-
-
Save robmint/1904c8b587078f68a8490896696130a6 to your computer and use it in GitHub Desktop.
Connect to the NZBCX bitcoin exchange via private API call
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$key = ''; // fill in these details | |
$secret = ''; | |
$id = ''; | |
// Nonce of the current Unix timestamp string encoded | |
$nonce = strval(time()); | |
$sigtext = $nonce . $id . $key; | |
$signature = hash_hmac ('sha256',$sigtext,$secret); | |
$prams = array( | |
'nonce' => $nonce, | |
'key' => $key, | |
'signature' => $signature | |
); | |
$url = 'https://nzbcx.com/api/account/balance'; | |
$request = array( | |
'http' => array( | |
'header' => "Content-type: application/x-www-form-urlencoded\r\n", | |
'method' => 'POST', | |
'content' => http_build_query($prams,'', '&'), | |
), | |
'ssl'=>array( | |
'allow_self_signed'=>true, | |
'verify_peer'=>false, | |
), | |
); | |
$context = stream_context_create($request); | |
$response = file_get_contents($url, false, $context); | |
var_dump($response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment