Accessing Nike+ data with PHP

Nike+ is a feature for the iPod nano which allows to measure time, distance and speed of runnings with a small sensor in running shoes that sends data to a transmitter on the iPod. Those data are sent to a users Nike+ account by iTunes whenever the iPod is synchronized. On the Nike+ website there is a report of runnings, the average speed, total kilometers run etc. The users can also compete with each other in virtual competitions and define goals to run more often, faster or a longer distance. The Nike+ website displays the data graphically with Adobe Flash.

There is no official API that allows you to use the raw data. Nevertheless the data are sent to the Flash via XML so there is a chance to use them. For PHP Rasmus Lerdorf himself has implemented a class to access these data. The class allows to authenticate a user and fetch the running data of a user in a XML-Format. This class can be found under Nike+ PHP API. To use that class you just have to create an object and pass the user credentials and optional caching parameters:

After the instantiation the object contains a SimpleXML object with all running information of that user that can be processed by any PHP application. The variables $data, $run, $challenges and $goals hold the information of the user account, runnings, ongoing challenges with other users and the personal goals of a user.
A partial output of the $data variable is shown below and contains among other things the total statistics of a user and the last recent run. The other data are represented in a similar way.

The Nike+ data can be used to display them on a website or to use them for mash up applications. For example there is already a word press plugin to display the data on a Blog System. Also there is another community called Runner+ which displays the data in a way similar to the Nike website.