Simple XML parsing error
Posted
by phpeffedup
on Stack Overflow
See other posts from Stack Overflow
or by phpeffedup
Published on 2010-05-04T20:04:27Z
Indexed on
2010/05/04
20:08 UTC
Read the original article
Hit count: 213
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?
© Stack Overflow or respective owner