Steam api 用户数据:仅适用于一个流,否则不起作用

Steam api user data: Only works for one steam id, else DOESNT WORK

我是 php 的新手,对 api 不太了解.. 我写了这段代码:

<?php
$steamkey = "xxxxxxxx"; // censored I use the right steamkey
$id_user = "76561198059606697"; // only this steam id works

$apifr = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=".$steamkey."&steamid=".$id_user;

$data = file_get_contents($apifr); // put the contents of the file into a variable

$test = json_decode($data);

echo print_r($test->playerstats->stats[0]->value, true);
?>

结果是玩家steam id的total_kills:

49999

结果“49999”是csgo玩家的正确total_kills,其实可以正常使用,但是如果我尝试不同的steamids就不行了...

有人可以帮我解释一下原因,或者提供另一个解决方案来使用 Steam api 获取 csgo 玩家统计信息吗?

谢谢大家

我尝试了 10 多个不同的正确 Steam ID,但是它们不起作用... 有些人有名字而不是例如“1231943812”作为 steam id,它也不起作用,我也不知道如何使用这些名字

您必须使用 public steamids,这意味着玩家必须将他们的个人资料设为 public 可见。

尝试此列表 https://steamdb.info/stats/toplevels/ 中的一些帐户,其中几乎只包含 public 个帐户。如果您可以看到这些玩家的个人资料详细信息,那么您应该能够获得该信息。

Here 您可以将个人资料页面转换为 steam id。