Here is the XML file: http://steamcommunity.com/profiles/76561198044834372/games?tab=all&xml=1
I tried to do it with SimpleXML, but with no success.
Can someone give me the code to read the game title?
For example,
<games>
<game>
<appID>570</appID>
<name>
<![CDATA[ Dota 2 ]]>
</name>
<logo>
<![CDATA[
http://media.steampowered.com/steamcommunity/public/images/apps/570/d4f836839254be08d8e9dd333ecc9a01782c26d2.jpg
]]>
</logo>
<storeLink>
<![CDATA[ http://steamcommunity.com/app/570 ]]>
</storeLink>
<hoursLast2Weeks>3.6</hoursLast2Weeks>
<hoursOnRecord>3.6</hoursOnRecord>
</game>
I want the name of the game: games->game->name of each game on the list.
Thanks in advance.
I think you need to see first "how to ask a question", anyway.
$xml = file_get_contents("http://steamcommunity.com/profiles/76561198044834372/games?tab=all&xml=1");
$xml = simplexml_load_string($xml);
foreach ($xml->games->game as $game) {
echo (string) $game->name;
}
Outputs;
Dota 2 Grand Theft Auto IV Champions Online: Free For All Company of Heroes Company of Heroes: Opposing Fronts Company of Heroes: Tales of Valor CrimeCraft GangWars Darksiders DC Universe Online Deus Ex: Human Revolution Global Agenda HOMEFRONT Demo Metro 2033 Red Faction: Armageddon Sniper: Ghost Warrior Team Fortress 2 The Lord of the Rings Online™ Tribes: Ascend