Quick Twitter

As I’ve mentioned, I’m enjoying Twitter a lot. The only problem is that it rarely works for me as it should — I’ve only had text updates to my phone for a day or two over the past couple of weeks, and I can no longer get updates via IM either.

While I still text stuff to Twitter when I’m out, it feels a bit like shouting into a void, unable to hear everyone else. I could use the web on my Treo to view updates but I found it all a bit clunky, getting a whole 24 hours of posts every time I wanted to see what was new. It’s a small problem, but enough to give me an excuse to have a bit of a play.

I used the API to create an extremely minimal page, with no graphics, that just displays the most recent twitters by my friends; all the posts since I last viewed the page. Beautifully simple and very satisfying. Here’s a static example.

If you’d like something similar, you can download this file, give it a .php file extension, put your email address and password in the correct places, and upload to your server.

(A word of caution though: put it somewhere private, preferably password-protected. Some of your friends might only be sharing posts with friends, and won’t want you broadcasting it to all and sundry, which is why I’m not showing you my actual page.)

Update: On the off-chance you downloaded this earlier, I’ve made a few tweaks to the code. It’s now on v1.3.1, so you may want to update if you have a previous version.

Update 2: I’ve just updated the file to the most recent version (v1.4) which includes a form for posting your status updates, although I seem to remember the code getting a bit messy. Posting can be a little flaky and I’ve now started using the new, official mobile interface which is more reliable than this script. (7 July 2007)

Comments

  • Hmm, this looks interesting. Been tinkering with a javascript to simulate a feed from a group of people. It's a shame there's only one group on Twitter, friends.

    Anyways, the javascript needs to call Twitter for each member to be possibly displayed (only showing the X latest in the feed) and I reckon it'll get too slow too quickly with a growing number in the group.

    Assuming everyone in the group is also in my list of friends this script saves me alot of time of having to write it myself, so thanks a bunch!

  • Actually had some problems with the dates, strtotime wouldn't take Twitters format. Ended up exploding it and putting it back together in a usuable format.

    Other then that it's a lovely script!

  • It's strange about strtotime() Ickmund -- I use it in the script to parse the Twitter dates and it seems to work for me.

  • To reduce the cost of using Twitter on your Treo you could use the Verichat IM client for Palm, which supports the AIM protocol now supported by Flickr. I am currently experimenting with this. Doesn't allow you to see Twitter updates however.

  • Good idea, thanks Nico. It looks like PDAApps is no longer selling Verichat, although it's still available on some other sites. SMSing my Twitters works fine for me at the moment, even if I can't see other people's, but I'll bear it in mind in the future.

  • Fantastic script Phil! I'm having problems with strtotime() as well though - even saving the twitter.txt file as a PHP doc and uploading it with no changes, it returns "31 Jan 1969" for every single post. If I take the _relativeTime function off of $this->created_at it displays the correct times for each post - for some reason the function makes the dates the same for each post as well. Can you offer any insight?

  • Colby, I'm not sure what's causing that I'm afraid. I've just posted v1.4, which seems to be working for me, so maybe give that a whirl and see if it's any better.

Commenting is disabled on posts once they’re 30 days old.

Saturday 2 December 2006, 4:58pm

< PreviousIn all of WritingNext >

2 Dec 2006 at Twitter

  • 11:31pm: time for bed Mr Square Eyes.
  • 10:40pm: Quick bit of Pepysing before bed, trying to get ahead for once.
  • 8:42pm: Bond: fun nonsense at first then overly-long boring nonsense. Titles were nice enough, but ruined by *appalling* theme tune.
  • 5:34pm: Off to see Bond, against my better judgement.
  • 5:17pm: Made a little Twitter thing: http://www.gyford.com/phil/writing/2006/12/02/quick_twitter.php
  • 4:22pm: Wishing he hadn't "upgraded" Opera on his Treo this morning, so that it no longer works.
  • 4:08pm: Back home, lunched on leftovers, crossing things off my all-too-computer-based to do list.
  • 11:09am: off to college for stupid 2 hour Saturday class that breaks up the weekend.
  • 10:18am: A bit of twittery coding.