Author

Topic: JSON HTTP - Ticker Help (Read 711 times)

full member
Activity: 182
Merit: 100
★Bitvest.io★ Play Plinko or Invest!
November 09, 2015, 09:57:54 AM
#4
The object you get from Cryptonator API is different from the Bitstamp one:

Bitstamp
Code:
stdClass Object
(
    [high] => 386.79
    [last] => 384.68
    [timestamp] => 1447080345
    [bid] => 383.50
    [vwap] => 377.17
    [volume] => 31617.08639580
    [low] => 360.54
    [ask] => 384.68
    [open] => 372.86
)

Cryptonator
Code:
stdClass Object
(
    [ticker] => stdClass Object
        (
            [base] => BTC
            [target] => USD
            [price] => 384.00554772
            [volume] => 86389.13547003
            [change] => 1.19810497
        )

    [timestamp] => 1447080181
    [success] => 1
    [error] =>
)

So basically you need something like:
Code:
  $btc_usd json_decode(file_get_contents('https://www.cryptonator.com/api/ticker/btc-usd'));
  echo 
$btc_usd->ticker->price;
?>

Awesome! Thanks alot. Smiley
sr. member
Activity: 345
Merit: 500
November 09, 2015, 09:47:32 AM
#3
The object you get from Cryptonator API is different from the Bitstamp one:

Bitstamp
Code:
stdClass Object
(
    [high] => 386.79
    [last] => 384.68
    [timestamp] => 1447080345
    [bid] => 383.50
    [vwap] => 377.17
    [volume] => 31617.08639580
    [low] => 360.54
    [ask] => 384.68
    [open] => 372.86
)

Cryptonator
Code:
stdClass Object
(
    [ticker] => stdClass Object
        (
            [base] => BTC
            [target] => USD
            [price] => 384.00554772
            [volume] => 86389.13547003
            [change] => 1.19810497
        )

    [timestamp] => 1447080181
    [success] => 1
    [error] =>
)

So basically you need something like:
Code:
  $btc_usd json_decode(file_get_contents('https://www.cryptonator.com/api/ticker/btc-usd'));
  echo 
$btc_usd->ticker->price;
?>

RJX
legendary
Activity: 1078
Merit: 1003
November 09, 2015, 09:45:11 AM
#2
Hello!

I need help to implement this API: https://www.cryptonator.com/api to my website.


Have you tried replacing the URL currently in the code with

Code:
https://www.cryptonator.com/api/ticker/btc-usd

No expert here but that's what I'd do.
full member
Activity: 182
Merit: 100
★Bitvest.io★ Play Plinko or Invest!
November 09, 2015, 09:12:01 AM
#1
Hello!

I need help to implement this API: https://www.cryptonator.com/api to my website.
Script im using: http://pastebin.com/YipGSH9G

please replace it with cryptonator API?
Thank you!
Jump to: