我目前正在通过
阅读某人的广告资源$inventory = file_get_contents("http://steamcommunity.com/profiles/{$Steam64}/inventory/json/730/2");
这类似于
file_get_contents("http://api.steampowered.com/ISteamUser/GetplayerSummaries/v0002/?key={$api}&steamids={$Steam64}");
这里我用
获取steamid64{$steam->response->players[0]->personaname}
如何获取广告资源.json
中的特定元素?例如:
{"success":true,"rgInventory":{"5904013658":{"id":"5904013658","classid":"469437901","instanceid":"302028390","amount":"1","pos":1},"5903531561":{"id":"5903531561","classid":"1293508920","instanceid":"0","amount":"1","pos":2},"5175566083":{"id":"5175566083","classid":"310780331","instanceid":"302028390","amount":"1","pos":3}
如何获得classid?我上面的解决方案对此不起作用: - (
我还需要阅读:
pos":22}},"rgCurrency":[],"rgDescriptions":{"469437901_302028390":{"appid":"730","classid":"469437901","instanceid":"302028390","icon_url":"-9a81dlWLwJ2UUGcV
此部分中的icon_url和其他内容。
问候
答案 0 :(得分:0)
似乎您的回复是JSON,请尝试如下:
$inventory = file_get_contents("http://steamcommunity.com/profiles/{$Steam64}/inventory/json/730/2");
$response = json_decode($inventory, true);
这将返回您可以轻松访问的关联数组。例如$response['...']['...']