Bitcoin Forum
April 24, 2024, 05:28:04 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  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?
2  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!