Bitcoin Forum

Bitcoin => Project Development => Topic started by: thefalleng2 on December 19, 2015, 01:28:37 AM



Title: Price displaying website like Coinmarketcap
Post by: thefalleng2 on December 19, 2015, 01:28:37 AM
I am looking to make a website to show the price of different altcoins like Coinmarketcap. I looked around and it seems to be all about modifying the api to set it up according to my needs.

I am wondering if there is any tutorial to learn how to fetch coins prices from sources. Also is there any easier way to do this? I am looking forward to everyone's replies :)


Title: Re: Price displaying website like Coinmarketcap
Post by: tarsua on December 19, 2015, 01:32:59 AM
yes there is an easier way to do it, use iframes, it isnt pretty but it gets the job done


Title: Re: Price displaying website like Coinmarketcap
Post by: thefalleng2 on December 19, 2015, 01:50:51 AM
yes there is an easier way to do it, use iframes, it isnt pretty but it gets the job done

Thanks for that info. It's not precisely what I am looking for but something quick.


Title: Re: Price displaying website like Coinmarketcap
Post by: music8mycomputer on December 19, 2015, 02:20:39 AM
It's all about the endpoint, for example: https://api.coinbase.com/v1/prices/spot_rate?currency=USD

It spits out json encoded data and you have to decode it.


Code:
<?php
$raw_coinbase_price_now 
file_get_contents('https://api.coinbase.com/v1/prices/spot_rate?currency=USD');

$json json_decode($raw_coinbase_price_now);
$coinbase_price $json->amount;
$coinbase number_format($coinbase_price2);
echo $coinbase;
?>