Bitcoin Forum
May 13, 2024, 01:10:24 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Other / Beginners & Help / Re: Has the API stopped responding for anyone else? [PHP question] on: June 19, 2011, 12:41:11 AM
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.
2  Other / Beginners & Help / Re: Has the API stopped responding for anyone else? [PHP question] on: June 18, 2011, 09:27:09 AM
Nevermind, seems to be working again.
3  Other / Beginners & Help / Has the API stopped responding for anyone else? [PHP question] on: June 18, 2011, 06:37:14 AM
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?
4  Economy / Service Discussion / Re: JQuery and mtgox ticker not playing nicely on: June 11, 2011, 10:18:55 AM
Easy, yes, but I have neither a reliable server nor a reliable IP.  I was hoping to rely on mtgox.
5  Economy / Service Discussion / Re: JQuery and mtgox ticker not playing nicely on: June 11, 2011, 08:06:50 AM
Quote
In the mean time, that means that you'll have to have your server grab the data and act as a proxy.

Darn, I was hoping to avoid that.  Ah well.

Thank you for your help!
6  Economy / Service Discussion / Re: JQuery and mtgox ticker not playing nicely on: June 11, 2011, 07:39:35 AM
But it -is- cross domain, so json isn't an option, right?

Firefox gives neither an error nor the javascript alert and chrome fails as expected with the following:

Code:
XMLHttpRequest cannot load https://mtgox.com/code/data/ticker.php. Origin http://[___MY_SITE___] is not allowed by Access-Control-Allow-Origin.
7  Economy / Service Discussion / JQuery and mtgox ticker not playing nicely on: June 11, 2011, 06:52:53 AM
Any thoughts on why this fails?

Code:
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
  $.ajax({
    url: 'https://mtgox.com/code/data/ticker.php',
    dataType: 'jsonp',
    success: function(data){
      // Note: because of failure, not even trying to print out the ticker data at this point
      alert('foo');
    }
  });
});
</script>
</head>
<body>
</body>
</html>

In firefox 4.0.1, I get this error:

Code:
Error: invalid label
Source File: https://mtgox.com/code/data/ticker.php?callback=jQuery1610765425372311095_1307774805819&_=1307774805835
Line: 1, Column: 1
Source Code:
{"ticker":{"high":28.601,"low":20.01,"vol":98283,"buy":21.751,"sell":21.8156,"last":21.8158}}

In chrome 12.0.742.91, I get these errors:

Code:
ticker.php: -1Resource interpreted as Script but transferred with MIME type text/html.
ticker.php: 1Uncaught SyntaxError: Unexpected token :
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!