Skype Status with custom images

! This post hasn't been updated in over a year. A lot can change in a year including my opinion and the amount of naughty words I use. There's a good chance that there's something in what's written below that someone will find objectionable. That's fine, if I tried to please everybody all of the time then I'd be a Lib Dem (remember them?) and I'm certainly not one of those. The point is, I'm not the kind of person to try and alter history in case I said something in the past that someone can use against me in the future but just remember that the person I was then isn't the person I am now nor the person I'll be in a year's time.

It’s simple to display your Skype status on your website or blog, the nice people at Skype even have a web page that will generate the code to do it for you.

What they don’t offer, however, is a way to customise the images displayed for your status so if you want something different you’re buggered.

So, with the (not inconsiderable) help of one of my old Enemy Territory clan-mates, Dave Workman, I’ve done it myself.

<?php
$file = "http://mystatus.skype.com/stuartparr.txt";
system("wget -N $file");
$handle = fopen("stuartparr.txt", "r");
$string = fgets($handle);
$before = ‘<a href="skype:stuartparr">’;
$after = "</a>";
if ($string=="Offline" || $string=="Unknown" || $string=="Do Not Disturb")
{
$before="";
$after="";
}
echo($before.'<img src="http://www.wonkosworld.co.uk/images/skype/’.$string.’.png" />’.$after);
?>

Skype offer various ways of displaying your status, one of which is a text file with your status in it. You access this via the url http://mystatus.skype.com/<username>.txt. The file above tells the operating system to run wgets to retrieve the file at that location. This will only work on a Linux/Unix server unless your Windows server has wgets installed.

After the operating system gets the file, the php script opens the file and then gets the contents and stores them in $string. If the status of Skype is Offline or Unknown then there is no point linking the status icon to Skype you so the next couple of lines check the status and blank out the $quot;before" and "after" text so a link isn’t generated.

The final line actually displays the icon by inserting the contents of the text file into a url for an image.

2 comments

  1. Dunc (9 comments) says:

    I’ve never thought of using system commands like wget for getting web pages.. I have always used php’s file_get_contents function:
    http://uk2.php.net/manual/en/function.file-get-contents.php

  2. wonkotsane (1133 comments) says:

    The files at skype.com won’t open like that. I’m told by my guru that it’s because the there are no headers or something along those lines.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.