Thu, 28 Feb 08

National Rail Train Times by SMS (again)

31 Jan 2009. This service is no longer running. Please see this post if you’re interested to find out why.

A while back I hacked a simple SMS interface onto the national rail enquiries website. It turned out to be more gimmicky than functional and I left it to die. Over the past couple of weeks I’ve found myself, once again, in need of such a service and so spent a couple of hours last night reviving it: making it work, making it simpler and tidying the code. The previous interface required the source station and destination station as well as the date and time of travel. The format was very strict (requiring you to use the unique three digit station codes) and, as I found, overly complex (I could never remember what it was). All I really wanted to do was specify the source and destination stations and get a list of the next few departures/arrival times.

The new interface is simply in the format of SOURCE_STATION to DESTINATION_STATION. So, to find the next few trains from Ramsgate to London Waterloo East we can send the following direct message to the natrailenq user on twitter

d natrailenq ramsgate to london waterloo east

Although you can now use the full station name it will only, currently, work if you know the exact name of the station (so, waterloo east wouldn’t work in that above example, but london waterloo east will). It will still work if you supply the three digit station code.

In order to use this service, you will need to create a twitter account, follow the natrailenq user and enable SMS notifications from natrailenq.