Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

update BTCTicker in order to use coingeko API#40

Open
valerio-vaccaro wants to merge 2 commits intom5stack:masterfrom
valerio-vaccaro:master
Open

update BTCTicker in order to use coingeko API#40
valerio-vaccaro wants to merge 2 commits intom5stack:masterfrom
valerio-vaccaro:master

Conversation

@valerio-vaccaro
Copy link
Copy Markdown

update BTCTicker in order to use coingeko API via a PHP filtering page,
exception error message improving

This is an updated version using coingecko.com API via a simple PHP page hosted at URL https://m5stack.it/btc

PHP code:
<?php
        $url = "https://api.coingecko.com/api/v3/coins/bitcoin?localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false";
        $json = file_get_contents($url);
        $json = json_decode($json);
        $high_24h = $json->market_data->high_24h->usd;
        $low_24h = $json->market_data->low_24h->usd;
        $current_price = $json->market_data->current_price->usd;
        $last_updated = $json->last_updated;
        echo "{\"last_updated\":\"$last_updated\",\"high_24h\":\"$high_24h\",\"low_24h\":\"$low_24h\",\"current_price\":\"$current_price\"}";
?>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant