Pages:
Author

Topic: mtgox API (Read 5912 times)

sr. member
Activity: 322
Merit: 251
August 27, 2012, 12:43:23 PM
#26
Anyone?

I did a lot of googling and searching on the forum but couldn't find any working methods
(all of them were made in 2011, and worked with name+pass login)

Thanks in advance! Smiley
sr. member
Activity: 322
Merit: 251
August 25, 2012, 09:00:42 PM
#25
Since the change in march 2012 the API isn't accessible with username/password
but it seems to work with the API key.

But whatever I'm trying to get this in VBA, this doesn't work for me..  Undecided

When replacing the name & password with API key doesn't work,
and the wiki also isn't very helpful

Code:

Set http = CreateObject("MSXML2.ServerXMLHTTP")
http.Open "GET", "https://mtgox.com/code/getFunds.php", False
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.Send ""

Can someone please help me with this? Smiley
Rights at the MtGox website are checked, so that shouldn't be the problem..


Thanks in advance Smiley



*Because I don't want to create a new topic with a question of an existing topic, I post it right here Smiley
sr. member
Activity: 395
Merit: 250
July 04, 2011, 03:25:43 PM
#24
Thanks, found the error - I was forgetting the header...
   Req.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
sr. member
Activity: 395
Merit: 250
July 04, 2011, 01:58:44 PM
#23
Hmmm... I'm also getting this "error:not logged in" message. Maybe someone can give me a hint what I'm doing wrong? And, sorry, yes - I actually did try it in VBA Grin makes it easier to do the bookkeeping for tax reasons as everything gets feeded into Excel.
Attached the part where I try to check my funds (obviously MyName and MyPass are my correct username and password Smiley
Code:
   Set Req = New WinHttpRequest
   Req.Open "POST", "https://mtgox.com/code/getFunds.php", False
   Req.Send "name=MyName&pass=MyPass"

Hihgly appreciated if someone could help me here Smiley

Thanks!!!
legendary
Activity: 1288
Merit: 1076
June 17, 2011, 07:55:18 AM
#22
Is this still working? I am getting {"error":"not logged in"}

works fine here.


curl --sslv3 -k -d "name=yourname&pass=yourpassword" https://mtgox.com/code/getFunds.php ;
full member
Activity: 222
Merit: 100
www.btcbuy.info
June 17, 2011, 12:51:43 AM
#21
Is this still working? I am getting {"error":"not logged in"}
legendary
Activity: 1288
Merit: 1076
April 14, 2011, 09:49:52 PM
#20

If I want to do this more properly, i.e. using the MtGox certificate, anyone knows how I could do?

I've seen on the web that I can retrieve the certificate with:

openssl s_client -connect www.mtgox.com:443 -showcerts

but I see several certificates (I think it's a chain or something).

Any idea?
hero member
Activity: 588
Merit: 500
April 14, 2011, 01:47:21 AM
#19
Hi,

Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue)

This needs openssl 0.9.8j or later. On both ends.

Running openssl 1.0.0d here~

Well the bug probably isn't in OpenSSL then. Smiley
vip
Activity: 608
Merit: 501
-
April 14, 2011, 01:25:38 AM
#18
Hi,

Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue)

This needs openssl 0.9.8j or later. On both ends.

Running openssl 1.0.0d here~
hero member
Activity: 588
Merit: 500
April 13, 2011, 02:29:24 PM
#17
Hi,

Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue)

This needs openssl 0.9.8j or later. On both ends.
vip
Activity: 608
Merit: 501
-
April 13, 2011, 01:46:13 AM
#16
Hi,

Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue)


Mark
newbie
Activity: 29
Merit: 0
April 08, 2011, 08:49:38 AM
#15
ah i finally found out what was going wrong:
the server has disabled SSLv2,
and if you don't specify to use SSLv3 with curl,
it looks like it's doing a weird SSL handshake.

Code:
curl --sslv3 -d `cat credentials` https://www.mtgox.com/code/getFunds.php
{"usds":0.22,"btcs":39.74}
Cheesy

Thanks for all the advice.
newbie
Activity: 29
Merit: 0
April 08, 2011, 08:33:06 AM
#14
the gentoo packages with given USE flags, is what i used to produce the above errors
Code:
[ebuild] dev-libs/openssl-1.0.0d  USE="zlib -bindist -gmp -kerberos -rfc3779 -sse2 -test"
[ebuild] net-misc/wget-1.12-r3  USE="debug ipv6 nls ssl -idn -ntlm -static"

I now tried to compile curl with gnutls to see if it makes a difference
Code:
[ebuild  N    ] dev-libs/libtasn1-2.9-r1  USE="-doc"
[ebuild  N    ] net-libs/gnutls-2.10.5  USE="cxx nls zlib -bindist -doc -examples -guile -lzo -test"
[ebuild   R   ] net-misc/curl-7.21.4  USE="gnutls* ipv6 ssl static-libs* -ares -idn -kerberos -ldap -libssh2 -nss -test -threads"
I tried the -k option to not check certificates since curl-7.21.4 ships without any certificate bundle on gentoo.
Code:
curl -v -k -d `cat credentials` https://www.mtgox.com/code/getFunds.php
* About to connect() to www.mtgox.com port 443 (#0)
*   Trying 69.64.54.59... connected
* Connected to www.mtgox.com (69.64.54.59) port 443 (#0)
* found 142 certificates in /etc/ssl/certs/ca-certificates.crt
* gnutls_handshake() failed: A TLS packet with unexpected length was received.
* Closing connection #0
curl: (35) gnutls_handshake() failed: A TLS packet with unexpected length was received.
same handshake which fails, but a more verbose error message.
hero member
Activity: 490
Merit: 509
My avatar pic says it all
April 08, 2011, 07:53:55 AM
#13
BTW, I haven't seen any equivalent of the "--no-check-certificate" option in curl's manual page.

"curl -k"
legendary
Activity: 1288
Merit: 1076
April 08, 2011, 07:42:00 AM
#12
If it works with wget and not with curl that's because the CA mtgox used isn't in the certificate bundle that's included with curl. The CA bundle included with curl is notorious for being out of date.

If it doesn't work at all, my best guess is a misconfigured load balancer or poisoned DNS.


BTW, I haven't seen any equivalent of the "--no-check-certificate" option in curl's manual page.
hero member
Activity: 490
Merit: 509
My avatar pic says it all
April 08, 2011, 07:29:36 AM
#11
If it works with wget and not with curl that's because the CA mtgox used isn't in the certificate bundle that's included with curl. The CA bundle included with curl is notorious for being out of date.

If it doesn't work at all, my best guess is a misconfigured load balancer or poisoned DNS.
legendary
Activity: 1288
Merit: 1076
April 08, 2011, 07:18:13 AM
#10
hum... it worked for me.

What versions of wget and libssl do you use?

Mines are:

libssl0.9.8:
  Installed: 0.9.8o-7
  Candidate: 0.9.8o-7
  Version table:
 *** 0.9.8o-7 0
        500 http://ftp.fr.debian.org/debian/ sid/main i386 Packages
        100 /var/lib/dpkg/status
     0.9.8o-5 0
        500 http://ftp.fr.debian.org/debian/ testing/main i386 Packages
wget:
  Installed: 1.12-3
  Candidate: 1.12-3
  Version table:
 *** 1.12-3 0
        500 http://ftp.fr.debian.org/debian/ sid/main i386 Packages
        100 /var/lib/dpkg/status
     1.12-2.1 0
        500 http://ftp.fr.debian.org/debian/ testing/main i386 Packages
newbie
Activity: 29
Merit: 0
April 08, 2011, 07:10:55 AM
#9
using wget gives the same SSL problem.
The strange thing is that connecting to the api worked fine last month.
Now when i connect from a server in the USA or from Europe, they both give the same error.
That's why i suspect that either curl and wget both got updated SSL libraries with an backwards incompatible SSL handshake (highly unlikely),
or something changed in the implementation of the SSL handshake at mtgox.com (more plausible).

Code:
Setting --check-certificate (checkcertificate) to 0
Setting --proxy (useproxy) to 0
Setting --output-document (outputdocument) to -
Setting --post-data (postdata) to name=username&pass=password
DEBUG output created by Wget 1.12 on linux-gnu.

--2011-04-08 13:05:40--  https://mtgox.com/code/getFunds.php
Resolving mtgox.com... 69.64.54.59
Caching mtgox.com => 69.64.54.59
Connecting to mtgox.com|69.64.54.59|:443... connected.
Created socket 3.
Releasing 0x09a22868 (new refcount 1).
Initiating SSL handshake.
SSL handshake failed.
Closed fd 3
Unable to establish SSL connection.
legendary
Activity: 1288
Merit: 1076
April 08, 2011, 06:37:58 AM
#8
Well, if it doesn't work with curl, at least it does with wget.  See above.

However, you might need to use a SSL-compiled version.  See docs.
newbie
Activity: 29
Merit: 0
April 08, 2011, 06:00:02 AM
#7
It seems like strace is saying the filehandle #3 which is the socket connecting to www.mtgox.com is temporarily unavailable...  Undecided

Code:
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.3.5.9")}, 16) = 0
gettimeofday({1302256486, 388590}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 1 ([{fd=3, revents=POLLOUT}])
send(3, "\325\327\1\0\0\1\0\0\0\0\0\0\3www\5mtgox\3com\0\0\1\0\1", 31, MSG_NOSIGNAL) = 31
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 5000) = 1 ([{fd=3, revents=POLLOUT}])
send(3, "\331\231\1\0\0\1\0\0\0\0\0\0\3www\5mtgox\3com\0\0\34\0\1", 31, MSG_NOSIGNAL) = 31
gettimeofday({1302256486, 389446}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4999)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [31])                = 0
recvfrom(3, "\331\231\200\204\0\1\0\0\0\0\0\0\3www\5mtgox\3com\0\0\34\0\1", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.3.5.9")}, [16]) = 31
gettimeofday({1302256486, 390649}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4997)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [47])                = 0
recvfrom(3, "\325\327\201\200\0\1\0\1\0\0\0\0\3www\5mtgox\3com\0\0\1\0\1\300"..., 2017, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.3.5.9")}, [16]) = 47
close(3)                                = 0
time(NULL)                              = 1302256486
alarm(0)                                = 300
rt_sigaction(SIGALRM, {SIG_DFL, [], 0}, NULL, 8) = 0
clock_gettime(CLOCK_MONOTONIC, {1803000, 314203809}) = 0
clock_gettime(CLOCK_MONOTONIC, {1803000, 314352260}) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("69.64.54.59")}, 16) = -1 EINPROGRESS (Operation now in progress)
clock_gettime(CLOCK_MONOTONIC, {1803000, 315242561}) = 0
clock_gettime(CLOCK_MONOTONIC, {1803000, 315361942}) = 0
poll([{fd=3, events=POLLOUT|POLLWRNORM}], 1, 1000) = 1 ([{fd=3, revents=POLLOUT|POLLWRNORM}])
clock_gettime(CLOCK_MONOTONIC, {1803000, 423547755}) = 0
getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
getpeername(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("69.64.54.59")}, [16]) = 0
getsockname(3, {sa_family=AF_INET, sin_port=htons(51327), sin_addr=inet_addr("10.3.5.152")}, [16]) = 0
clock_gettime(CLOCK_MONOTONIC, {1803000, 423965800}) = 0
clock_gettime(CLOCK_MONOTONIC, {1803000, 424148309}) = 0
clock_gettime(CLOCK_MONOTONIC, {1803000, 424284143}) = 0
stat64("/dev/urandom", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
open("/dev/urandom", O_RDONLY)          = 4
read(4, "\205h\fg\212\306\271t\301Y[\25\20\".\201=\17\232\230s\315\3217]\272\340\7\266\207\265*"..., 1024) = 1024
close(4)                                = 0
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 4
fstat64(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
poll([{fd=4, events=POLLIN}], 1, 10)    = 1 ([{fd=4, revents=POLLIN}])
read(4, "\272\353\325\367M\n\316\360\23}\204\321U\275\223\264\332P6Q7\27\300\247\20\321v\313P\360\344\361", 32) = 32
close(4)                                = 0
getuid32()                              = 0
time(NULL)                              = 1302256486
clock_gettime(CLOCK_MONOTONIC, {1803000, 427442199}) = 0
time(NULL)                              = 1302256486
brk(0x8b1c000)                          = 0x8b1c000
time(NULL)                              = 1302256486
write(3, "\26\3\1\0\340\1\0\0\334\3\1M\236\333f\372|\273Lw\373\7.\232&\1$\354<\303\273\241"..., 229) = 229
read(3, 0x8af36d8, 7)                   = -1 EAGAIN (Resource temporarily unavailable)
Pages:
Jump to: