Hamachi Web Status Indicator Classes
It’s been about a year since I last released something, so I am going to throw these little utility classes up.
A long time ago I downloaded some PHP script that demonstrated parsing LogMeIn’s Hamachi web status indicator to build a little Hamachi list for a web site. I cannot for the life of me find the little script – I suspect it was just a forum post I found. Anyway, over the years I rewrote the damn thing three times over, trying to get it into a more generalized form. Thus I introduce my two Hamachi status classes.
HamachiClient – represents an individual Hamachi client. Basically, just instantiate one of these buggers with a 5.x.x.x IP and then ask it what its state is. Pretty simple I hope.
HamachiList – can contain multiple HamachiClient classes. You can instantiate this class without any parameters and add the IP addresses later. or you can feed it one array of IP addresses and aliases in the beginning. Then either ask it for the state of each client, or have it return the complete array. I also included a method to output an HTML list that can be formatted with CSS.
Note: I also got annoyed with the fact that only clients version 1.0.x can enable the web status indicator. The obvious implications are that Linux and Mac versions of Hamachi are left in the cold. I included the possibility of pinging these clients if the web indicator doesn’t work. That’s an advanced parameter and you’ll have to look in the code to figure out what to do
Please visit the snippets section to download…