Bitcoin Forum

Bitcoin => Project Development => Topic started by: Tasty Champa on August 26, 2011, 09:31:07 PM



Title: how are you pulling JSON from exchanges?
Post by: Tasty Champa on August 26, 2011, 09:31:07 PM
Every time I look at the page source of tickers, order books and charts, I don't see anything.
Is this all happening with SSI?


Title: Re: how are you pulling JSON from exchanges?
Post by: nimnul on August 28, 2011, 01:27:24 PM
It's all happening with AJAX and Websockets/Socket.IO


Title: Re: how are you pulling JSON from exchanges?
Post by: hamburger on August 30, 2011, 09:48:17 AM
You find the URL for the API - see below, this is for getting the South African Rand price of Bitcoin

http://www.bitcoin.za.org/api

If you call the page directly with your browser you will get something like this;

{"ZAR":"62.78"}

In PHP you can do this;

Code:
<?php

$_rate 
file_get_contents("http://www.bitcoin.za.org/api");
$obj json_decode($_rate);
$_rate $obj->{'ZAR'};

echo 
"ZAR = $_rate";

?>


This will result in;

ZAR = 62.78

Hope it help you or someone.

Hamburger



Title: Re: how are you pulling JSON from exchanges?
Post by: brandon@sourcewerks on August 31, 2011, 04:15:10 PM
What exchanges are you looking to extract JSON data from?

I have written libraries for some exchanges already.  See my sig