views:

64

answers:

1

I'm using simplexml_load_file() to fetch my Twitter RSS feed and process it:

$feed = 'http://twitter.com/statuses/user_timeline/user.rss';
$tweets = simplexml_load_file($feed)

The data itself looks like this:

<item>
    <title>Title</title>
    <description>This is a description</description>
    <pubDate>Sun, 15 Aug 2010 18:21:20 +0000</pubDate>
    <guid>http://twitter.com/XXX&lt;/guid&gt;
    <link>http://twitter.com/XXX&lt;/link&gt;
    <twitter:source>Tweetie for Mac</twitter:source>
    <twitter:place/>
</item>

Everything works as expected, except <twitter:source> and <twitter:place> are never loaded into the $tweets array.

How can I modify this code so that all the fields are processed?

Thanks!

+2  A: 
$feed = 'http://twitter.com/statuses/user_timeline/user.rss';
$tweets = simplexml_load_file($feed);

foreach($tweets->channel->item as $i => $v)
{
    echo $v->title . "<br />";
}

$tweets is not an array

jakenoble
So why the down vote?
jakenoble
Wrikken
Yup, that was it, the tags disappeared, edited the question to display it correctly, now the phrasing doesn't seem that much off.
Wrikken
I am confused :-( ...... oh i see now. *wants 2 reps back*
jakenoble