我真的是php的新手,对apis也不太了解。我写了这段代码:
<?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,它实际上工作得很好,但是如果我尝试不同的steamid,它就不能再工作了……
有没有人可以帮我解释一下原因,或者给出另一个解决方案来使用steam api来获取csgo播放器的统计数据?
谢谢大家
我尝试了超过10个不同的右蒸汽I,但他们不工作…有些人有名字而不是例如"1231943812“作为一个流id,它也不能工作,我也不知道如何使用名字
发布于 2019-09-08 07:47:42
您必须使用公共 steamids,这意味着球员必须将他们的个人资料放到公共可见性中。
尝试此列表https://steamdb.info/stats/toplevels/中的一些帐户,该列表几乎只包含公共帐户。如果你可以看到这些球员的个人资料,那么你就应该能够获得这些信息。
Here您可以将配置文件页面转换为steam ids。
https://stackoverflow.com/questions/55787182
复制相似问题