/** * Fetchs data from the Steam Community by querying the XML version of the * profile specified by the ID of this Steam ID * * @throws SteamCondenserException if the Steam ID data is not available, * e.g. when it is private, or when it cannot be parsed */ public function fetchData() { $profile = $this->getData($this->getBaseUrl() . '?xml=1'); if (!empty($profile->error)) { throw new SteamCondenserException((string) $profile->error); } if (!empty($profile->privacyMessage)) { throw new SteamCondenserException((string) $profile->privacyMessage); } $this->nickname = htmlspecialchars_decode((string) $profile->steamID); $this->steamId64 = (string) $profile->steamID64; $this->limited = (bool) (int) $profile->isLimitedAccount; $this->tradeBanState = (string) $profile->tradeBanState; $this->vacBanned = (bool) (int) $profile->vacBanned; $this->imageUrl = substr((string) $profile->avatarIcon, 0, -4); $this->onlineState = (string) $profile->onlineState; $this->privacyState = (string) $profile->privacyState; $this->stateMessage = (string) $profile->stateMessage; $this->visibilityState = (int) $profile->visibilityState; if ($this->isPublic()) { $this->customUrl = strtolower((string) $profile->customURL); $this->headLine = htmlspecialchars_decode((string) $profile->headline); $this->hoursPlayed = (double) $profile->hoursPlayed2Wk; $this->location = (string) $profile->location; $this->memberSince = (string) $profile->memberSince; $this->realName = htmlspecialchars_decode((string) $profile->realname); $this->steamRating = (double) $profile->steamRating; $this->summary = htmlspecialchars_decode((string) $profile->summary); } if (!empty($profile->mostPlayedGames)) { foreach ($profile->mostPlayedGames->mostPlayedGame as $mostPlayedGame) { $this->mostPlayedGames[(string) $mostPlayedGame->gameName] = (double) $mostPlayedGame->hoursPlayed; } } if (!empty($profile->groups)) { foreach ($profile->groups->group as $group) { $this->groups[] = SteamGroup::create((string) $group->groupID64, false); } } if (!empty($profile->weblinks)) { foreach ($profile->weblinks->weblink as $link) { $this->links[htmlspecialchars_decode((string) $link->title)] = (string) $link->link; } } $this->fetchTime = time(); }
/** * Fetches the groups this user is member of * * Uses the ISteamUser/GetUserGroupList interface. * * @return SteamGroup[] The groups of this user * @see getGroups() */ public function fetchGroups() { $params = ['steamid' => $this->getSteamId64()]; $result = WebApi::getJSONObject('ISteamUser', 'GetUserGroupList', 1, $params); $this->groups = []; foreach ($result->response->groups as $groupData) { $this->groups[] = SteamGroup::create($groupData->gid, false); } return $this->groups; }