Author

Topic: How to add current quote on website? (Read 113 times)

legendary
Activity: 2982
Merit: 2681
Top Crypto Casino
December 15, 2022, 11:39:29 AM
#4
TryNinja already give you a nice solution, but there are some other ways to do this, maybe you can try with a JS widget. If you search for them then you will find tons of it. But I would like to recommend the one from co-in.

Code:
CurrencyRate.Today

I like this one because you can personalize the coins and the colors you want to use for your widget. And it looks like this:


Source: https://co-in.io/crypto-price-widget/
legendary
Activity: 1470
Merit: 1353
December 07, 2022, 08:20:45 PM
#3
TryNinja is right, the simplest way would be using some of the freely available API endpoints.

For example:
https://www.coingecko.com/en/api
https://www.blockchain.com/explorer/api
https://coinmarketcap.com/api/
legendary
Activity: 2758
Merit: 6830
December 07, 2022, 08:17:27 PM
#2
Using Coingecko's API:

Code:
$ch curl_init("https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd");
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HEADER0);
$data curl_exec($ch);
curl_close($ch);
$price json_decode($data)->bitcoin->usd;

echo 
"Price is {$price}"
?>


Or just switch to another API and get the data according to the resulting structure. Honestly, that's something you should definitely know how to do if you are coding your own website. Tongue
newbie
Activity: 5
Merit: 0
December 07, 2022, 07:40:09 PM
#1
Hello guys...
I'm looking for a way in php to add the current quote value of cryptocurrency like BTC and ETH? Where do I get this information and where can I get it from?

I'm putting together a website and would like to add this updated quote...
Jump to: