Author

Topic: Mt. Gox API problems (Read 1479 times)

newbie
Activity: 42
Merit: 0
June 19, 2011, 01:21:17 PM
#10
Thats right, it does not. But it worked, suddenly it just runs endless.
I havent changed anything, it must be a change withing mtgox.

Jup, I assume they did it because of the DDoS attacks - although I would guess this does not change a thing, really.
But they apparently really changed something, so you'll have to change your code.

That's exactly the problem with Mt. Gox - or let's say the biggest problem - they would not communicate if their life depended on it. Central change in the API? Why worry! Nobody needs to know...
newbie
Activity: 44
Merit: 0
June 19, 2011, 11:27:59 AM
#9
There was another thread, i'm to lazy to look it up now, where they found that you have to supply some user agent string. Does not matter what, but you need to supply one.
Maybe your function does not do that?

Thats right, it does not. But it worked, suddenly it just runs endless.
I havent changed anything, it must be a change withing mtgox.
Thanks for your help.

regards, redshark1802
newbie
Activity: 42
Merit: 0
June 19, 2011, 11:02:05 AM
#8
There was another thread, i'm to lazy to look it up now, where they found that you have to supply some user agent string. Does not matter what, but you need to supply one.
Maybe your function does not do that?
newbie
Activity: 44
Merit: 0
June 19, 2011, 08:30:25 AM
#7
what if your just trying to pull pricing and not do transactions.

Hi,

that's my code:
Code:
$mtgoxJSON = file_get_contents("https://mtgox.com/code/data/ticker.php");
$mtgoxJSON = utf8_encode($mtgoxJSON);
$mtgoxJSON = json_decode($mtgoxJSON);

I tried various timeout options but not one is working.

regards, redshark1802
sr. member
Activity: 364
Merit: 250
June 19, 2011, 04:41:02 AM
#6
what if your just trying to pull pricing and not do transactions.
newbie
Activity: 42
Merit: 0
June 19, 2011, 03:23:11 AM
#5
Well, I finally found the solution to my problem, and realized that the API description is just very misleading.
Instead of
Code:
https://mtgox.com/code/buyBTC.php?name=blah&pass=blah&amount=#&price=#
it should say
Code:
https://mtgox.com/code/buyBTC.php
with POST parameters name, pass, amount, price:

Code:
 $.ajax({
                type: 'POST',
                url: 'https://mtgox.com/code/sellBTC.php',
                dataType: 'json',
                data: {name: this.strUser,
                       pass: this.strPass,
                       amount: numAmount,
                       price: numPrice},
                success: this.onSellSuccess.bind(this, funCallback),
                error: this.onSellFailure.bind(this, funCallback)
            });

Ticker data, i.e. last price, should work, however you have to be careful to always use "https" - I had some issues where "http" would return an error, but not always...
newbie
Activity: 44
Merit: 0
June 19, 2011, 02:52:08 AM
#4
I had a working file_get_contents script to show the last price.  Then my page started to run infinitely with no results yesterday.  Switched file_get_contents to the cURL method.  Now curl times out before getting any results, even though the command line curl works.  I don't know what happened, but all of a sudden I can't use their API!

I have the same problems. I have no idea what is going wrong on their side.
Has anybody an alternative solution?

kind regards, redshark1802
hero member
Activity: 630
Merit: 500
June 19, 2011, 02:38:04 AM
#3
I had a working file_get_contents script to show the last price.  Then my page started to run infinitely with no results yesterday.  Switched file_get_contents to the cURL method.  Now curl times out before getting any results, even though the command line curl works.  I don't know what happened, but all of a sudden I can't use their API!
sr. member
Activity: 364
Merit: 250
June 19, 2011, 02:02:05 AM
#2
I had a perfectly working script and now all it does is crank away forever never getting results back from mtgox.. I have spent over 3 hours trying to fix to no avail..

newbie
Activity: 42
Merit: 0
June 18, 2011, 01:54:48 PM
#1
Hi,

I have a problem with the Mt. Gox trading API, namely with the buy and sell scripts:
Code:
https://www.mtgox.com/code/sellBTC.php?name=USERNAME&pass=PASS&amount=3&price=30
will give me "{"error": "Not logged in. Log in"}".
A call to
Code:
https://mtgox.com/code/getOrders.php?name=USERNAME&pass=PASS
works, however.

It does not work in a browser, but it also does not work in JS:
Code:
$.ajax({
            type: 'POST',
            url: 'https://mtgox.com/code/sellBTC.php?name=USERNAME&pass=PASS&amount=' + numAmount + '&price=' + numPrice,
            dataType: 'json',
            data: {},
            success: this.onSellSuccess.bind(this, funCallback),
            error: this.onSellFailure.bind(this, funCallback)
        }); 
will not work either, yielding the same error.

As I found few people having the same problem and no answers, I'm wondering whether I'm doing something wrong....
Also Mt. Gox support did not answer my request for help.
Jump to: