Bitcoin Forum
May 05, 2024, 08:33:04 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: JSON HTTP - Ticker Help  (Read 693 times)
BTC Tipster (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 100


★Bitvest.io★ Play Plinko or Invest!


View Profile
November 09, 2015, 02:12:01 PM
 #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!

1714897984
Hero Member
*
Offline Offline

Posts: 1714897984

View Profile Personal Message (Offline)

Ignore
1714897984
Reply with quote  #2

1714897984
Report to moderator
1714897984
Hero Member
*
Offline Offline

Posts: 1714897984

View Profile Personal Message (Offline)

Ignore
1714897984
Reply with quote  #2

1714897984
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714897984
Hero Member
*
Offline Offline

Posts: 1714897984

View Profile Personal Message (Offline)

Ignore
1714897984
Reply with quote  #2

1714897984
Report to moderator
RJX
Legendary
*
Offline Offline

Activity: 1078
Merit: 1003


umachit.fund


View Profile
November 09, 2015, 02:45:11 PM
 #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.

.UmaChit.Fund.
‎ ★
..Revolutionized Rotating..
..Savings & Borrowings.....

‎ ★
█████
██
██
██
██
██
██
██
██
██
██
██
█████
█████
██
██
██
██
██
██
██
██
██
██
██
█████
████████████████████████████
████████████████████████████
████████████████████████████
█████████████████▀▀  ███████
█████████████▀▀      ███████
█████████▀▀   ▄▄     ███████
█████▀▀    ▄█▀▀     ████████
█████████ █▀        ████████
█████████ █ ▄███▄   ████████
██████████████████▄▄████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████▀▀▀█████████
██████ ▀██████▀      ▄██████
██████▄   ▀▀▀        ███████
██████▄             ▄███████
███████▄           ▄████████
██████▀▀▀        ▄██████████
███████▄▄     ▄▄████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
████████████████████████████
█████████████▀    ██████████
████████████    ▄▄██████████
███████████▀    ▀▀██████████
██████████▌       ██████████
████████████    ████████████
████████████    ████████████
████████████    ████████████
████████████▄  ▄████████████
████████████████████████████
████████████████████████████
micaman
Sr. Member
****
Offline Offline

Activity: 345
Merit: 500



View Profile WWW
November 09, 2015, 02:47:32 PM
 #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:
<?php
  $btc_usd 
json_decode(file_get_contents('https://www.cryptonator.com/api/ticker/btc-usd'));
  echo 
$btc_usd->ticker->price;
?>

BTC Tipster (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 100


★Bitvest.io★ Play Plinko or Invest!


View Profile
November 09, 2015, 02:57:54 PM
 #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:
<?php
  $btc_usd 
json_decode(file_get_contents('https://www.cryptonator.com/api/ticker/btc-usd'));
  echo 
$btc_usd->ticker->price;
?>

Awesome! Thanks alot. Smiley

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!