I am trying to redesign my homepage at the moment and in the process applying my new found skills with PHP. :) One thing I put in on all the versions of my homepage is a online status indicator with Yahoo! so that people can contact me directly and have their bricks on my face. Usually I go with the normal script code Yahoo! with their default images for online and offline statuses. But this time, I wanted to display custom images for my online and offline status indicators.

A quick search led me to a where online status is checked using various links from yahoo themselves. It was a good source of inspiration. I used this piece of code:


Which showed a 00 for offline and 01 for online. After a million errors, my newbie skills finally graduated and I created this script which checks for online and offline status of a username and displays custom images depicting the same.

//Insert yahoo messenger status
$check_it = “http://mail.opi.yahoo.com/online?u=getanand321&m=a&t=1″;
$id =”getanand321″;
$online=”<a href=’ymsgr:sendIM?getanand321′><img src=’http://www.theanand.com/images/online-smile.png’ border=’0′></a><br>”;
$offline=”<img src=’http://www.theanand.com/images/offline-smile.png’><br>”;
$file = fopen(“$check_it”.”$id”, “r”);$read = fread($file, 200);
$read = ereg_replace($id, “”, $read);
if ($y = strstr ($read, “00”)) {
$x = “$offline”;
}elseif ($y = strstr ($read, “01”)) {
$x = “$online”;
echo (“$x”);

Put this into a html page and save it as a .php file and upload. Done! I was surprised that I could do this in just 10-15 lines of code than be using any third party script! Hope this helps those who are looking for a solution to display their yahoo messenger status on their websites and homepages. I will soon share a script where you can display your blogs latest posts on a static homepage, in this case, my homepage which is in html at the moment.

Update: I just noted that this same procedure can be used to find if an user is invisible in yahoo or not! This is another accidental yahoo messenger invisible hack!!!

For updates on Yahoo Online/Offline Status Indicator
Enter your email here: