Steam api用户数据:仅适用于一个蒸汽ID,否则DOESNT WORK

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

php
dosi8657
dosi8657 我把它改回原来我怎么做以及它怎么不能正常工作,谢谢..请帮忙
一年多之前 回复
dqd72925
dqd72925 抱歉,我将我的代码编辑成字符串“ZyklopRT”以更好地测试它而不是变量,以检查变量是否无效。
一年多之前 回复
dou2347
dou2347 您没有在代码中使用$id_user...
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐