php - Bittrex API request -


i'm trying wallet balance bittrex api , don't understand why code provided bittrex documentation doesn't work :

$apikey = 'xxx'; $apisecret = 'xxx'; $nonce = time(); $uri = 'https://bittrex.com/api/v1.1/market/getopenorders?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); $obj = json_decode($execresult); 

the curl_exec function returns false, don't understand why. thank !

try add further error handling, smthing this

try {     $ch = curl_init();      if (false === $ch)         throw new exception('failed initialize');      curl_setopt($ch, curlopt_url, $uri);     curl_setopt($ch, curlopt_returntransfer, 1);      $execresult = curl_exec($ch);      if (false === $execresult)         throw new exception(curl_error($ch), curl_errno($ch));  } catch(exception $e) {      trigger_error(sprintf(         'curl failed error #%d: %s',         $e->getcode(), $e->getmessage()),         e_user_error);  } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -