Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // NOTE: NOT working, posted for support...
- function quoine_get() {
- // API settings
- $auth_payload['path'] = '/crypto_accounts';
- $auth_payload['nonce'] = (microtime(true)*10000);
- $auth_payload['token_id'] = $this->apiKey;
- $user_secret = $this->apiSec;
- $sign = JWT::encode($auth_payload, $user_secret, 'HS256');
- // generate the extra headers
- $headers = array(
- 'X-Quoine-API-Version: 2',
- 'Content-Type: application/json',
- 'X-Quoine-Auth: '.$sign
- );
- // our curl handle (initialize if required)
- static $ch = null;
- if (is_null($ch)) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- }
- curl_setopt($ch, CURLOPT_URL, 'https://api.quoine.com/crypto_accounts');
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- // run the query
- $res = curl_exec($ch);
- if ($res === 'FALSE') throw new Exception('Could not get reply: '.curl_error($ch));
- $dec = json_decode($res, true);
- return $dec;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement