从 SteamID 获取玩家名称


get Player Name from SteamID

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

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

我也看过其他问题,没有一个帮助我。

我查看了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;
    }
}