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

独自空忆成欢 提交于 2019-12-31 05:41:11

问题


I'm really new to php and doesnt understand much with apis.. I wrote this code:

<?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);
?>

the result is the total_kills of the player steam id:

49999

The result "49999" are the right total_kills of the player in csgo, which actually works just fine, but if I try different steamids it doesnt work anymore...

Could someone please help me and explain why or give another solution to use the steam api for csgo player stats?

Thank you all

I tried more then 10 different right steam ids, however they doesnt work... Some people have names instead of for example "1231943812" as a steam id, it doesnt work too, I dont know how to use the names too


回答1:


You must use public steamids which means the player has to put their profile to public visibility.

Try some accounts from this list https://steamdb.info/stats/toplevels/ which includes almost only public accounts. If you can see the profile details of these players than you should be able to get that info.

Here you can convert the profile pages into steam ids.



来源:https://stackoverflow.com/questions/55787182/steam-api-user-data-only-works-for-one-steam-id-else-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!