Converting XML file elements into a PHP array -
i'm trying convert steam group members list xml file array using php. xml file is: http://steamcommunity.com/groups/starhawk/memberslistxml/?xml=1.xml
the elements member's steam ids, such 76561198000264284
how can go doing this?
edit: far i've used this:
$array = json_decode(json_encode((array)simplexml_load_string($xml)),1);
it outputs first few elements, not ones
this should return accessible array:
$get = file_get_contents('http://steamcommunity.com/groups/starhawk/memberslistxml/?xml=1.xml'); $arr = simplexml_load_string($get); print_r($arr);
you can access items this:
echo $arr->groupid64; echo $arr->members->steamid64;
edit: parse streamid, can loop
$ids = $arr->members->steamid64; foreach($ids $id) { echo $id; }
Comments
Post a Comment