Illusory Follies Andrew Flanagan's Blog

11Apr/082

Integration of Information = Value

... at least in some cases.

It's easy to store information on your cell phone by typing some text in. It's more advanced to be able to send text messages. But what about providing a "universal" interface (meaning a web services interface) that can receive text and makes text available?

This is what Twitter does. I wasn't very impressed when I first heard about it a while back because it seemed so... simplistic. Anyone can write a simple database with users and allow them to post text messages. But I was missing the point.

I can now use my cell phone to send a message to Twitter (there's a program called MobileTwitter that I just downloaded and installed. This text messages pretty much instantly wings its way to the Twitter servers. From there, people can subscribe to my "stream" of messages using desktop-based clients (I use Spaz on my MacBook and my Windows PC). However, I'm not stuck using one companies application -- all I need to do is poll the web service. A simple curl call will easily retrieve my latest Twitter message

curl -u andrewflanagan:mypassword http://twitter.com/statuses/user_timeline
/andrewflanagan.xml?count=1 -s -o /var/twitter/andrewflanagan.xml

and a few lines of PHP will make it displayable on my web page:

$xml = new SimpleXMLElement('/var/twitter/andrewflanagan.xml', 0, true);
$status = $xml->status->text;

Alternatively I could have the PHP script directly call Twitter but I ran into some problems since it takes longer to load the pages each time someone visits and Twitter unfortunately limits requests to 70/hr which results in ugliness when I get too many hits on my site. So instead I set up a cron job that runs every 5 minutes (using the curl call above) and updates the locally-stored XML file.

But anyway, the point of this is that you can easily define new interfaces for entering, receiving, and displaying text. It's simplistic, yes. But it means that on my way back from work (in the car) I can update the front page of my blog with a message using my cellphone. I can also be pulled over by a state trooper. They have no appreciation for the depth and usefulness of this technology!