/** * create the steam profile url * e.g. STEAM_0:0:123456 * Steam_community_number = (Last_part_of_steam_id * 2) + 76561197960265728 + Second_to_last_part_of_steam_id * this needs bcmath support in PHP * http://www.php.net/manual/en/book.bc.php * @param string $steamId * @return string $ret */ function getSteamProfileUrl($steamId) { $ret = $steamId; $s = calculateSteamProfileID($steamId); $ret = '<a href="http://steamcommunity.com/profiles/' . $s . '" target="_blank">' . $steamId . '</a>'; return $ret; }
/** * get the public steam stats if available for this player/game * https://partner.steamgames.com/documentation/community_data * http://steamcommunity.com/profiles/76561197968575517/stats/L4D/?xml=1 */ private function _getSteamStats($steamID) { $sPID = calculateSteamProfileID($steamID); if (!empty($sPID) && isset($this->_statsGames[$this->_game])) { $url = "http://steamcommunity.com/profiles/" . $sPID . "/stats/" . $this->_statsGames[$this->_game] . "/?xml=1"; $data = getDataFromURL($url); if (!empty($data)) { $xml = @simplexml_load_string($data); if ($xml !== false) { foreach ($xml->achievements->achievement as $achievement) { $att = $achievement->attributes(); $closed = (string) $att['closed']; if ($closed === "1") { # closed is achieved $this->_playerData['steamAchievements'][] = array('name' => (string) $achievement->name, 'desc' => (string) $achievement->description, 'picture' => (string) $achievement->iconClosed); } } } } } }