Bitcoin Forum
April 19, 2024, 11:21:34 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Has the API stopped responding for anyone else? [PHP question]  (Read 1040 times)
tenbatsu (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 18, 2011, 06:37:14 AM
 #1

I used to be able to query the mtgox ticker with the following code:

Code:
 
  $c = curl_init();
  curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($c, CURLOPT_URL, 'https://mtgox.com/code/data/ticker.php');
  curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  $result = curl_exec($c);
  curl_close($c);

2~3 hours ago that stopped working.  I tried saving the certificate so I could query as follows:

Code:
  $c = curl_init();
  curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($c, CURLOPT_URL, 'https://mtgox.com/code/data/ticker.php');
  curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true);
  curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2);
  curl_setopt($c, CURLOPT_CAINFO, "./CAcerts/www.mtgox.com");
  $result = curl_exec($c);
  curl_close($c);

That didn't work either.  Did the API change somehow or is my code simply off?
Even if you use Bitcoin through Tor, the way transactions are handled by the network makes anonymity difficult to achieve. Do not expect your transactions to be anonymous unless you really know what you're doing.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713525694
Hero Member
*
Offline Offline

Posts: 1713525694

View Profile Personal Message (Offline)

Ignore
1713525694
Reply with quote  #2

1713525694
Report to moderator
tenbatsu (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 18, 2011, 09:27:09 AM
 #2

Nevermind, seems to be working again.
lightbox
Full Member
***
Offline Offline

Activity: 212
Merit: 100


View Profile WWW
June 18, 2011, 04:55:28 PM
 #3

Not working again for me Sad for about the past hour or so...

but wget works fine, so something with php/curl is causing the problem

use im using SSL_VERIFYPEER  FALSE  and SSL_VERIFYHOST  FALSE


https://www.canadianbitcoins.com for quick & easy buy/sell with $CAD
Canada's Oldest Bitcoin Brokerage.  Serving Canadian Bitcoiners since 2011!
lightbox
Full Member
***
Offline Offline

Activity: 212
Merit: 100


View Profile WWW
June 18, 2011, 05:49:23 PM
 #4

Solved, MagicalTux must have changed something, because now USERAGENT is required.

curl_setopt($ch, CURLOPT_USERAGENT, "curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18");

did the trick




https://www.canadianbitcoins.com for quick & easy buy/sell with $CAD
Canada's Oldest Bitcoin Brokerage.  Serving Canadian Bitcoiners since 2011!
de_bert
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
June 18, 2011, 05:52:14 PM
 #5

Seeing how you have some experience with the mt. gox api, could you please have a look at my issue?
http://forum.bitcoin.org/index.php?topic=18934.0

Thanks!
philipp
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
June 18, 2011, 05:54:22 PM
 #6

Same problem here. libcurl doesn't work, but plain curl does. Will try setting the useragent.

Philipp
philipp
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
June 18, 2011, 05:56:33 PM
 #7

Solved, MagicalTux must have changed something, because now USERAGENT is required.

curl_setopt($ch, CURLOPT_USERAGENT, "curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18");

did the trick





Yeah. For the C programmers out there:

curl_easy_setopt(curl, CURLOPT_USERAGENT, "Some bot.");

will do the trick.

Philipp

Clark
Hero Member
*****
Offline Offline

Activity: 548
Merit: 502


So much code.


View Profile WWW
June 18, 2011, 10:27:09 PM
 #8

Thanks so much for posting this! My services had bombed out today due to this change.

It would be nice for MagicalTux to create a developer mailing list or forum thread to keep us aware of this kind of thing...

tenbatsu (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 19, 2011, 12:41:11 AM
 #9

Quote
It would be nice for MagicalTux to create a developer mailing list or forum thread to keep us aware of this kind of thing...

That or a page describing the API would be awesome.
Dirt Rider
Member
**
Offline Offline

Activity: 111
Merit: 10


View Profile
June 19, 2011, 05:43:01 AM
 #10

Solved, MagicalTux must have changed something, because now USERAGENT is required.

curl_setopt($ch, CURLOPT_USERAGENT, "curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18");

did the trick

I usually don't even consider "tips" but damn lightbox, you just solved a HUGE headache for me!

Donation address please!
lightbox
Full Member
***
Offline Offline

Activity: 212
Merit: 100


View Profile WWW
June 24, 2011, 01:39:25 AM
 #11

Solved, MagicalTux must have changed something, because now USERAGENT is required.

curl_setopt($ch, CURLOPT_USERAGENT, "curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18");

did the trick

I usually don't even consider "tips" but damn lightbox, you just solved a HUGE headache for me!

Donation address please!

Lol glad i could help, i only pounded my head on the desk for about an hour to figure it out :p  now if only mtgox would get back up so I can finish the tweaks on the bot!

Thanks for the offer of a tip! here's an address: 1NgFb2LyyLvGaSHWasi2sYsn7iXDzDqzvb

https://www.canadianbitcoins.com for quick & easy buy/sell with $CAD
Canada's Oldest Bitcoin Brokerage.  Serving Canadian Bitcoiners since 2011!
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!