Bitcoin Forum
December 09, 2016, 03:38:15 PM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Has the API stopped responding for anyone else? [PHP question]  (Read 832 times)
tenbatsu
Newbie
*
Offline Offline

Activity: 7


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?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
tenbatsu
Newbie
*
Offline Offline

Activity: 7


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

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

Activity: 212


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


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
Jr. Member
*
Offline Offline

Activity: 42


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
Jr. Member
*
Offline Offline

Activity: 30


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
Jr. Member
*
Offline Offline

Activity: 30


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: 540


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...

PGP KEY | 1Bitcoin3Tg2KWyAq3wzivdqwYqGwKYaGd
tenbatsu
Newbie
*
Offline Offline

Activity: 7


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


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


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!