我想了解用户是否属于Steam组。为此,我使用Steam的Web API并使用URL:使用PHP在JSON URL响应中查找特定条目
https://api.steampowered.com/ISteamUser/GetUserGroupList/v1/?key=APIKEYHERE&steamid=STEAMID64HERE
获取用户所属的所有组的JSON响应。 现在我想知道他们是否是我使用PHP的ID:1111111的特定组的一部分。
如何做到这一点?目前我的代码被解码如下:
$groupid = "1111111";
$url = "https://api.steampowered.com/ISteamUser/GetUserGroupList/v1/?key=APIKEYHERE&steamid=STEAMID64HERE";
$result = file_get_contents($url);
// Will dump a beauty json :)
$pretty = json_decode($result, true);
这使得$ pretty变量包含整个JSON响应。 我将如何使用PHP在看起来像这样的响应中查找组ID?
{
"response": {
"success": true,
"groups": [
{
"gid": "4458711"
},
{
"gid": "9538146"
},
{
"gid": "11683421"
},
{
"gid": "24781197"
},
{
"gid": "25160263"
},
{
"gid": "26301716"
},
{
"gid": "29202157"
},
{
"gid": "1111111"
}
]
}
}
无法弄清楚。 有什么帮助吗? :)
请检查我的答案,让我任何其他帮助 – Abhijit
没有工作,请参阅评论 –
检查.. PLZ等待 – Abhijit