get data from XML

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
Tompa
Forum Newbie
Posts: 10
Joined: Thu Mar 20, 2008 12:40 pm

get data from XML

Post by Tompa »

Hi,

I have this xml; http://steamcommunity.com/id/suxxez/?xml=1 (example)
and Im now looking to get the data from the profile->onlineState node and put it into an php array to use on my website. How can I do this?

Thanks,
Tom
Tompa
Forum Newbie
Posts: 10
Joined: Thu Mar 20, 2008 12:40 pm

Re: get data from XML

Post by Tompa »

sorted it myself :P

final code:

Code: Select all

$fetch_steam_status = 'http://steamcommunity.com/profiles/'.$ds['steam_id_name'].'/?xml=1';
            $xml = simplexml_load_file($fetch_steam_status);
            
            $steam_nickname = $xml->steamID;
            $steam_status = $xml->onlineState;
            $steam_status_msg = $xml->stateMessage;
            $steam_play_time = $xml->hoursPlayed2Wk;
Post Reply