Tag Archive: xml

XML Twitter Feed Not Working? The Twitter Feed XML has been removed/changed

Looks like twitter have turned off XML feeds…

Here’s where you can find XML feed for your tweets:

https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=AlanHart

You can also use (Thanks to @steveclarkcouk for this one) …

https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=true&include_rts=true&screen_name=alanhart&count=2

(This includes all the original xml fields. Change “count=2” to retrieve more than 2 tweets)

*Obviously replace “AlanHart” with your username ;)

Hope this helps someone!

There are a few changes:

As an example: I am loading the xml into a cache file and updating this every 5 minutes (keeps it up to date but stops each webpage request hammering twitter)

I then load the XML from the cache file into a VAR:

$xml = simplexml_load_file($cache_file);

var_dump($xml); // will show the array data for debugging

And output for each tweet:

foreach($xml->channel->item as $entry) {echo ($entry->title);}

Differences i have noticed:

1. The xml is nested differently:

Used to be: $xml -> status

Now: $xml ->channel->item

2. User Profile Picture

used to be: $entry->user->profile_image_url (This no longer exists)

3. Tweet text

used to be: $entry->text (this is now: $entry->title)

4. Tweet Date

used to be: $entry->created_at (this now: $entry->pubDate)