HTML 使用 Steam API 获取价格

HTML use Steam API to get price

本文关键字:获取 API 使用 Steam HTML      更新时间:2023-09-26

我想在我的主页上显示一个案例的成本。Steam API 是: http://steamcommunity.com/market/priceoverview/?currency=3&appid=730&market_hash_name=Chroma%202%20Case

如何使用此链接给出的字符串?

我尝试了这样的事情:

首先,也许你想看看这些页面:要获取包含file_get_contents的页面内容:http://php.net/manual/en/function.file-get-contents.php

并使用json_decode解码 json 数据:http://php.net/manual/en/function.json-decode.php

$json = file_get_contents("http://steamcommunity.com/market/priceoverview/?currency=3&appid=730&market_hash_name=Chroma%202%20Case");
    $decode = json_decode($json,1);
    echo $decode['median_price'];