iRacing Widget

By | 30th January 2019

Recently, I was looking around for an iRacing web API so that I could display some info here on my website. I found one written in Java, but it seemed to be mostly broken. So, I decided to code my own using PHP.

My first task was to enable the display of the current standings for a chosen racing series. Most of my time was spent scanning the source code of the official iRacing website to extract the required URLs which are used to display the data. Once I had these I was able to create some PHP classes to handle the calls.

At this point I decided that I’d really like a WordPress widget so that I could display a standings table in my sidebar. I’ve never created a Widget before, so I had to research how to do this. It proved a fairly simple task and so, as you can see in my sidebar, I have a working iRacing standings Widget. The settings allow you to choose a series, a division and the number of places to display and also whether or not to show your own position tagged on to the end should it not appear in the range you’ve chosen to display. The current season, week and track are displayed and updated automatically. The data is cached for a couple of hours, so it isn’t constantly calling the iRacing web pages. However, if you change the Widget settings the data will be immediately updated.

You can download the Widget from my downloads page. Note that you will need a valid iRacing account to use the Widget as the data can only be accessed after you’ve logged in.