Simple XML parsing error
- by phpeffedup
I'm trying to iterate through a Twitter XML File, where the container tag is , and each user is . I need to create a variable $id based on the XML attribute for each user.
Username is already instantiated.
$url = "http://api.twitter.com/1/statuses/friends/$username.xml";
$xmlpure = file_get_contents($url);
$listxml = simplexml_load_string($xmlpure);
foreach($listxml->users->children() as $child)
{
$id = $child->{"id"};
//Do another action
}
But I'm getting this error:
Warning: main() [function.main]: Node no longer exists in /home/.../bonus.php on line 32
Line 32 is the foreach statement, and I don't actually USE the main() method.
What am I doing wrong?