嗨,我想得到当前的金属价格值,如黄金使用有效的api。我试过谷歌,但没找到。我可以看到这里的黄金价格 http://goldseek.com/ , https://goldprice.org/ . 但我找不到api。因此,如果有人可以获得当前的黄金或白银价格使用php它将是非常有用的
从第二个环节 https://goldprice.org/ ,
我知道了,
$json = file_get_contents('https://data-asg.goldprice.org/dbXRates/USD'); $decoded = json_decode($json); $item = $decoded->items; $date = $decoded->date; $gold_price = $item[0]->xauPrice; echo "Gold price on ".$date." is ".$gold_price;