PHP Nike+ Stats Script
January 3rd, 2007I was looking for a PHP script to pull in stats so I could display them on my blog. It turns out Ernie Oporto had modified a script that was used for a Wordpress widget and put it up for download. One issue was that it did not do caching.
I took a few minutes and added caching on to it, it’s pretty simple right now, just saving a file to a tmp directory. That seems to keep the hitting of the Nike+ website down to a minimum.
I have more plans for this also:
— Make caching more robust, this one may not work on Windows servers
— Change the average time to be in minutes:seconds instead of decimal
— Allow user to customize formatting
— Functionize/Clean-up Script
I just took a few minutes on this, so there may be some issues, please add a comment and I’ll try to address it.
PHP Nike+ Stats v1.2 [Download]
You will need to save file as php instead of phps (which is for display).
Update:
I now present to you version 1.2.1. You can see a working version in my right sidebar.
— Rewrote code to easier add goals/challenges later
— Change Avg. Pace time seconds from decimal to roman
— Added more debugging info
— Few small minor changes
PHP Nike+ Stats v1.2.1 [Download]
Second Update: I haven’t really spent any time working on this lately, but Ernie has it updated so it is working now. Check it out here.





January 3rd, 2007 at 9:10 pm
Works like a charm. I’ve updated it on the site. Will work on this some more this weekend anyway. =)
January 3rd, 2007 at 9:12 pm
Excellent, I am working on it right now also, so I’ll ping you back when I have it updated more.
You want to throw it up on sourceforge or something and we both can work on it? Or would you rather just maintain it?
January 4th, 2007 at 9:16 am
Is there a time period listed somewhere? Like you’ve done 12 runs over how long? 12 months?
January 4th, 2007 at 9:23 am
The Nike+ site doesn’t actually give you that info in the XML.
January 4th, 2007 at 9:24 am
Ernie’s right…
You could do a couple of different things though. One is ask for a user specified start date and do some averages. The other I’m sure there is or will be a way to get all the run data, so you could figure it out from there…but that’s down the road.
January 4th, 2007 at 9:48 pm
I’ve been successful in pulling data from the Nikeplus.com site about challenges and goals in XML so I will be working that into the script Saturday. It works very much like what we have been doing, so it will be very much cut and paste with a little additional logic.
January 5th, 2007 at 3:53 am
I never cease to be amazed that you can geek-a-tize something as simple as running - but I guess if that’s what keeps you going, and at least you’re passionate about something.
January 5th, 2007 at 8:27 am
Yeah, I think if the tech encourages someone to get into running, then it was worth the effort.
January 6th, 2007 at 1:12 am
[...] This data was just pulled off the Nike site for me by the justdoingit people (only they don’t have decimals for tenths of miles apparently), but there are also wordpress plugins and the like that you can use. I’m using this one by Eric Byers in my sidebar. [...]
January 11th, 2007 at 12:17 pm
I can’t get the ipod download to wkrk today and it’s been working. Say’s “login from locale not allowed’ any ideas?
January 11th, 2007 at 1:24 pm
Jim, I saw that last night also, it appears Nike changed their script about 2 days ago (my runs haven’t been updated since then).
Hopefully there is a work around, but I haven’t even looked at it (besides finding the same error).
January 11th, 2007 at 8:00 pm
Same issue; login from locale not allowed.
justdoit still works, though. They must have a workaround
January 17th, 2007 at 11:20 pm
Ernie has it working again, check out his blog for the download.
February 1st, 2007 at 1:56 am
This is maybe cheeky but have you any plans to share the cool changes for sowing goals and previous runs?
February 1st, 2007 at 8:07 am
Well on the right hand side I’m actually using a combination of my script, and someone else’s. Check out Ernie’s site for the actual code for mine, and then there is a wordpress widget that does it, and you can find how to do all of it in there.
February 2nd, 2007 at 6:49 am
Cheers Eric
I’m using MT ofr my blog but I’ll have a look at the WP plugin and see if I can somehow use the script. Although I haven’t a clue about programming anything more than XHTML and CSS. I really should learn someday.
Enjoy your race tomorrow!
March 1st, 2007 at 8:40 pm
[...] apparently), but there are also wordpress plugins and the like that you can use. I’m using this one by Eric Byers in my [...]