not perfect, but at least it works:
function getSteamprofile($url, $return_all = 0)
{
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
$xml = file_get_contents($url);
xml_parse_into_struct($parser, $xml, $value);
xml_parser_free($parser);
if($value[12]['tag'] === "inGameInfo")
{
$contents['inGameInfo'][] = $value[13]['value'];
$contents['inGameInfo'][] = $value[14]['value'];
$contents['inGameInfo'][] = $value[15]['value'];
$contents['inGameInfo'][] = $value[16]['value'];
$contents['inGameInfo'][] = $value[17]['value'];
unset($value[13]);
unset($value[14]);
unset($value[15]);
unset($value[16]);
unset($value[17]);
$user['ingameinfo']['name'] = $contents['inGameInfo'][0];
$user['ingameinfo']['link'] = $contents['inGameInfo'][1];
$user['ingameinfo']['icon'] = $contents['inGameInfo'][2];
$user['ingameinfo']['logo'] = $contents['inGameInfo'][3];
$user['ingameinfo']['logo_s'] = $contents['inGameInfo'][4];
}
else
{
}
foreach( $value as $values )
{
$contents[$values['tag']][] = $values['value'];
}
unset($contents['inGameInfo'][5]);
unset($contents['inGameInfo'][6]);
$user['name'] = $contents['steamID'][0];
$user['state'] = $contents['onlineState'][0];
$user['msg'] = $contents['stateMessage'][0];
$user['avatar'] = $contents['avatarFull'][0];
$user['avatar_med'] = $contents['avatarMedium'][0];
$user['avatar_ico'] = $contents['avatarIcon'][0];
$user['vac'] = $contents['vacBanned'][0];
$user['url'] = $contents['customURL'][0];
$user['since'] = $contents['memberSince'][0];
$user['rating'] = $contents['steamRating'][0];
$user['hours_2wk'] = $contents['hoursPlayed2Wk'][0];
$user['headline'] = $contents['headline'][0];
$user['summary'] = $contents['summary'][0];
$user['mostplayed']['mostplayed'] = $contents['statsName'][0];
$user['mostplayed']['games'][$contents['gameName'][0]]['hours'] = $contents['hoursPlayed'][0];
$user['mostplayed']['games'][$contents['gameName'][1]]['hours'] = $contents['hoursPlayed'][1];
$user['mostplayed']['games'][$contents['gameName'][2]]['hours'] = $contents['hoursPlayed'][2];
$user['mostplayed']['games'][$contents['gameName'][0]]['link'] = $contents['gameLink'][0];
$user['mostplayed']['games'][$contents['gameName'][1]]['link'] = $contents['gameLink'][1];
$user['mostplayed']['games'][$contents['gameName'][2]]['link'] = $contents['gameLink'][2];
$user['mostplayed']['games'][$contents['gameName'][0]]['icon'] = $contents['gameIcon'][0];
$user['mostplayed']['games'][$contents['gameName'][1]]['icon'] = $contents['gameIcon'][1];
$user['mostplayed']['games'][$contents['gameName'][2]]['icon'] = $contents['gameIcon'][2];
$user['mostplayed']['games'][$contents['gameName'][0]]['logo'] = $contents['gameLogo'][0];
$user['mostplayed']['games'][$contents['gameName'][1]]['logo'] = $contents['gameLogo'][1];
$user['mostplayed']['games'][$contents['gameName'][2]]['logo'] = $contents['gameLogo'][2];
$user['mostplayed']['games'][$contents['gameName'][0]]['logo_s'] = $contents['gameLogoSmall'][0];
$user['mostplayed']['games'][$contents['gameName'][1]]['logo_s'] = $contents['gameLogoSmall'][1];
$user['mostplayed']['games'][$contents['gameName'][2]]['logo_s'] = $contents['gameLogoSmall'][2];
$user['favgame']['name'] = $contents['name'][0];
$user['favgame']['link'] = $contents['link'][0];
$user['favgame']['logo'] = $contents['logo'][0];
$user['favgame']['hours'] = $contents['hoursPlayed2wk'][0];
if( $return_all == false )
{
return $user;
}
else
{
return $contents;
}
}
$link = "https://steamcommunity.com/id/pfannkuchen_gesicht?xml=1";
$datas = getSteamprofile($link, 0);
echo "<pre>";print_r($datas);"</pre>";
Output:
[code]Array
(
[ingameinfo] => Array
(
[name] => Team Fortress 2
[link] => https://store.steampowered.com/app/440
[icon] => https://media.steampowered.com/steamcommunity/public/images/apps/440/e3f595a92552da3d664ad00277fad2107345f743.jpg
[logo] => https://media.steampowered.com/steamcommunity/public/images/apps/440/6f6d22ab0c357d9f02a11f76ff35797e4ccdf19f.jpg
[logo_s] => https://media.steampowered.com/steamcommunity/public/images/apps/440/d606e5858ff874b22647b6a2ae5f4d654eb2f4e5.jpg
)
[name] => pfannkuchen_gesicht
[state] => in-game
[msg] => In-Game
Team Fortress 2 - Join
[avatar] => https://media.steampowered.com/steamcommunity/public/images/avatars/74/74015438594ba8032cc41698bacc46deef2af787_full.jpg
[avatar_med] => https://media.steampowered.com/steamcommunity/public/images/avatars/74/74015438594ba8032cc41698bacc46deef2af787_medium.jpg
[avatar_ico] => https://media.steampowered.com/steamcommunity/public/images/avatars/74/74015438594ba8032cc41698bacc46deef2af787.jpg
[vac] => 0
[url] => pfannkuchen_gesicht
[since] => August 2, 2006
[rating] => 10
[hours_2wk] => 40.9
[headline] =>
[summary] => No information given.
[mostplayed] => Array
(
[mostplayed] => L4D
[games] => Array
(
[Left 4 Dead] => Array
(
[hours] => 18.5
[link] => https://store.steampowered.com/app/500
[icon] => https://media.steampowered.com/steamcommunity/public/images/apps/500/428df26bc35b09319e31b1ffb712487b20b3245c.jpg
[logo] => https://media.steampowered.com/steamcommunity/public/images/apps/500/0f67ee504d8f04ecd83986dd7855821dc21f7a78.jpg
[logo_s] => https://media.steampowered.com/steamcommunity/public/images/apps/500/0f67ee504d8f04ecd83986dd7855821dc21f7a78_thumb.jpg
)
[Painkiller Gold Edition] => Array
(
[hours] => 9.9
[link] => https://store.steampowered.com/app/3200
[icon] => https://media.steampowered.com/steamcommunity/public/images/apps/3200/3e8830b9553bc7b12fb3762eec097b44551988b2.jpg
[logo] => https://media.steampowered.com/steamcommunity/public/images/apps/3200/915a8bef104490cc568d5eacb3df680e13f11bb9.jpg
[logo_s] => https://media.steampowered.com/steamcommunity/public/images/apps/3200/1bb33297854c09f996dc3d8480f35c565f03c728.jpg
)
[Painkiller Overdose] => Array
(
[hours] => 6.8
[link] => https://store.steampowered.com/app/3270
[icon] => https://media.steampowered.com/steamcommunity/public/images/apps/3270/ab47a9209c8b6e7c5b81736a27489c9d22af46ff.jpg
[logo] => https://media.steampowered.com/steamcommunity/public/images/apps/3270/549dca50d8e2fd555a6abe115ac127731fc416a0.jpg
[logo_s] => https://media.steampowered.com/steamcommunity/public/images/apps/3270/2c3fbe2eceabe40c3cd98510b5ed51cd0e866a85.jpg
)
)
)
[favgame] => Array
(
[name] => Half-Life
[link] => https://store.steampowered.com/app/70
[logo] => https://media.steampowered.com/steamcommunity/public/images/apps/70/6bd76ff700a8c7a5460fbae3cf60cb930279897d.jpg
[hours] => 0
)
)
[/code]
EDIT:
example of use:
online
Ingame:
the joinbutton works!
Edit2:
another example: