Bitcoin Forum
June 27, 2024, 09:39:40 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: I need help with campbx's api  (Read 696 times)
the founder (OP)
Sr. Member
****
Offline Offline

Activity: 448
Merit: 251


Bitcoin


View Profile WWW
April 03, 2013, 02:43:56 PM
 #1

I need this

http://campbx.com/api/xticker.php

which outputs this

{"Last Trade":"140.21","Best Bid":"137.50","Best Ask":"140.00"}

to output just

140.21

Nothing more...  in PHP .. each time I try it I get an unexpected result...   

Can someone post a quick source on how to output it in this format?   It's to help with average spot price from all the exchanges,  campbx is one that for some reason gives me trouble even though it looks simple.


<? php 

FILL IN CODE HERE

?>

Seriously I would appreciate it...   


Bitcoin RSS App / Bitcoin Android App / Bitcoin Webapp http://www.ounce.me  Say thank you here:  1HByHZQ44LUCxxpnqtXDuJVmrSdrGK6Q2f
matt.collier
Member
**
Offline Offline

Activity: 105
Merit: 10



View Profile
April 05, 2013, 12:47:29 AM
 #2

<?php
$tuData = '{"Last Trade":"140.21","Best Bid":"137.50","Best Ask":"140.00"}';
$obj = json_decode($tuData);
$lastTrade = $obj->{"Last Trade"};
echo "Last Trade: ".$lastTrade."\n";
?>
the founder (OP)
Sr. Member
****
Offline Offline

Activity: 448
Merit: 251


Bitcoin


View Profile WWW
April 05, 2013, 01:14:50 AM
 #3

Thank you so much I'm on my mobile now but I'm going to test this second I get home!!

Bitcoin RSS App / Bitcoin Android App / Bitcoin Webapp http://www.ounce.me  Say thank you here:  1HByHZQ44LUCxxpnqtXDuJVmrSdrGK6Q2f
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!