Bitcoin Forum
May 13, 2024, 08:59:41 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BITTREX API + WAMP Server  (Read 359 times)
DogWelder (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 23, 2017, 04:46:09 PM
 #1

Hi all,

I've been trying to use the Bittrex API on WampServer 3.0.6 x64 (default setting).
I'm using the default example from the Bittrex API page (https://bittrex.com/Home/Api) but I'm not getting any results (simple php commands work however).

$apikey='blahblahmykey';
$apisecret='blahblahmysecret';
$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);


Can anyone suggest a possible solution or an alternative webserver with which they've had success? Thanks in advance.
1715590781
Hero Member
*
Offline Offline

Posts: 1715590781

View Profile Personal Message (Offline)

Ignore
1715590781
Reply with quote  #2

1715590781
Report to moderator
1715590781
Hero Member
*
Offline Offline

Posts: 1715590781

View Profile Personal Message (Offline)

Ignore
1715590781
Reply with quote  #2

1715590781
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715590781
Hero Member
*
Offline Offline

Posts: 1715590781

View Profile Personal Message (Offline)

Ignore
1715590781
Reply with quote  #2

1715590781
Report to moderator
1715590781
Hero Member
*
Offline Offline

Posts: 1715590781

View Profile Personal Message (Offline)

Ignore
1715590781
Reply with quote  #2

1715590781
Report to moderator
1715590781
Hero Member
*
Offline Offline

Posts: 1715590781

View Profile Personal Message (Offline)

Ignore
1715590781
Reply with quote  #2

1715590781
Report to moderator
poordeveloper
Hero Member
*****
Offline Offline

Activity: 896
Merit: 527


₿₿₿₿₿₿₿


View Profile WWW
August 23, 2017, 05:16:41 PM
 #2

Do you have the json and curl PHP extensions installed?

🎰 Bitcoin Casinos ⭐⭐⭐⭐⭐
.
🔵 Buy Bitcoin (Visa / Mastercard / SEPA / Bank Transfer / Western Union / MoneyGram / RIA)
DogWelder (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 23, 2017, 06:01:03 PM
 #3

Do you have the json and curl PHP extensions installed?

Hi! Yes, curl is running (uncommented in php.ini, also ran a simple function to check if enabled). From what I see, the variable $execResult is returned empty.
I have been deleting and making new API keys/secrets in the hopes that there lies the problem, but nothing seems to change.
poordeveloper
Hero Member
*****
Offline Offline

Activity: 896
Merit: 527


₿₿₿₿₿₿₿


View Profile WWW
August 23, 2017, 06:11:39 PM
 #4

Maybe the problem lies on the fact that it's an https request? It's possible curl doesn't trust the server certificate. Add error_reporting(E_ALL); at the start of the script to see what the error is.

🎰 Bitcoin Casinos ⭐⭐⭐⭐⭐
.
🔵 Buy Bitcoin (Visa / Mastercard / SEPA / Bank Transfer / Western Union / MoneyGram / RIA)
DogWelder (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 23, 2017, 06:44:08 PM
 #5

Error reporting didn't show anything, but after googling a bit, I found this page: http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/.
I used the quick fix (for now) by adding the line:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Many thanks for your help!
poordeveloper
Hero Member
*****
Offline Offline

Activity: 896
Merit: 527


₿₿₿₿₿₿₿


View Profile WWW
August 23, 2017, 06:53:45 PM
 #6

Error reporting didn't show anything, but after googling a bit, I found this page: http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/.
I used the quick fix (for now) by adding the line:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Many thanks for your help!

That's what I told you regarding curl not trusting the server. However I'd be wary of doing so since it makes your script/site open to MITM attacks (intercepting the request to bittrex.com)

🎰 Bitcoin Casinos ⭐⭐⭐⭐⭐
.
🔵 Buy Bitcoin (Visa / Mastercard / SEPA / Bank Transfer / Western Union / MoneyGram / RIA)
DogWelder (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 24, 2017, 07:16:19 PM
 #7

Of course, what I meant is that I googled about curl and the server certificates just like you suggested, and found the answer. I'll implement the secure solution as soon as I've finalized the script.
Many thanks again!
irmscher
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
December 22, 2017, 08:27:16 PM
 #8

Hey guys

I was having the same problem, tried to fix it with curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Now I'm getting Error 404: We can't seem to find what you're looking for, here's a screenshot:

https://hyfzgg.bl3302.livefilestore.com/y4my6dTFJ4lSTljw0wLyTh370Q07MMleB7jX5QSUaP92Cde5kOrZcpl01-jZZlXdAFwSrx1qinYvKIaSwgZUgRrW-AZggbpcKy_69w7PBi3kffRZ7rSS8OG9mflqNn47BgG2adB4VOqkBDshgWhUPc31id0FgUWWxOXcB_Kcp_oNCqRbmFBZg5tJJ3yYwyp4xj-nq7UYXMgK5rIrDmKVAx3Tw/2017-12-22.png

Here's my code (I'm using WAMP and 7.1.9 php version):

Code:
<?php
$apikey
='myKey';
$apisecret='mySecret';
$nonce=time();
$uri='https://bittrex.com/api/v1.1/market/getbalances?apikey='.$apikey.'&nonce='.$nonce;
$sign=hash_hmac('sha512',$uri,$apisecret);

$ch curl_init($uri);
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_HTTPHEADER, array('apisign:'.$sign));
$execResult curl_exec($ch);
$obj json_decode($execResult);
?>

Any ideas what might be wrong?
Thanks Smiley

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!