我找不到我的问题的答案。
我已经使用javascript运行html文件,这在我的网站上显示了我的实际汇率。
<div id="price1"></div>
const API_URL = 'https://api.coinmarketcap.com/v1/ticker/?limit=1';
function displayData() {
fetch(API_URL)
.then(res => res.json())
.then(json => {
const topCoin = json[0];
document.getElementById('price1').innerHTML = `${topCoin.price_usd}` + "BTC";
});
}
setInterval(displayData, 500);
但是我想要的是将此速率写入.txt文件。是否可以使用javascript或我必须使用另一种语言?如果我必须使用其他方式,您可以帮我吗?