We use a “Live Chat” feature on our website to connect our clients with our technicians. Yahoo! has a great tool for adding your online status to any web page you choose. The code is pretty straight forward:
<a href="http://messenger.yahoo.com/edit/send/?.target=YOUR_YAHOO_ID">
<img border="0" src="http://opi.yahoo.com/yahooonline/u=YOUR_YAHOO_ID/m=g/t=2/l=us/opi.jpg">
</a>
Will return this Yahoo!-provided image:

Playing around with the Yahoo! provided source yields up to 17 different images. Changing the t=2 tag above to t=0 will give you:

Here’s what’s avaialbe (t=0 through t=16):

















Yahoo! gives us a pretty good range of options… but what if we want to use a custom image or text? Let’s look at the code again, this time, paying close attention to:
http://opi.yahoo.com/online?u=YOUR_YAHOO_ID&m=a&t=1
Following that link in our browser brings us to what appears to be a status page that simply displays
00
if we’re logged off, and
01
if we’re signed in.
If we play with this URL a bit and change t=1 to t=0, we get the same status page with different output:
YOUR_YAHOO_ID is NOT ONLINE
or
YOUR_YAHOO_ID is ONLINE
For our purposes, less is more. We’ll write a simple PHP script that’ll check our online status and display a corresponding image depending on our online status. The PHP is:
<?php
$getstatus = file_get_contents('http://mail.opi.yahoo.com/online?u=YOUR_YAHOO_ID&m=a&t=1');
switch($getstatus) {
case "00": $status = '<img src="offline.jpg" />';
break;
case "01": $status = '<img src="online.jpg" />';
break;
}
echo $status;
?>
You can define $status however you’d like. Enjoy!
