从 SteamID 获取玩家名称

get Player Name from SteamID

我正在为 Garry Mod 的游戏服务器创建加载屏幕。 我需要一种方法将用户的 SteamID 或 CommunityID 转换为他们的名字。 又名 STEAM_0:1:48093934 -> NightmareInfinity76561198056453597 -> NightmareInfinity

我目前正在使用 PHP 和 JavaScript 进行转换。 如果你需要我的函数名 SteamID2Communityid($steamid)CommunityID2SteamID($communityid) 两个函数都在PHP

我也看了其他问题,None 对我有帮助。

我查看了 SteamAPI,但找不到任何内容。

这是我的一个旧 php 功能,应该仍然有效。

function EchoPlayerName($steamid){
    $xml = simplexml_load_file("http://steamcommunity.com/profiles/$steamid/?xml=1");//link to user xml
    if(!empty($xml)) {
        $username = $xml->steamID;
        echo $username;
    }
}