Yahoo Online/Offline Status Indicator

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:

http://mail.opi.yahoo.com/online?u=[username]&m=a&t=1

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=’https://www.theanand.com/images/online-smile.png’ border=’0′></a><br>”;
$offline=”<img src=’https://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”);
fclose($file);
?>

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!!!

22 thoughts on “Yahoo Online/Offline Status Indicator”

  1. I’m pretty sure I visited this topic not long time ago and there were more comments, and in one of the comment a guy posted a link to a page where you could see if a yahoo user is offline or invisible…it was a vietnam site, were the comments deleted ?

  2. Hi there I am trying to find some help about using the yahoo online status indicator

    I can insert the yahoo smily online face and get it to work ok

    First I have a chat site that alows users to check out other profiles and chat to them

    I have a list off all the members to my site and they all have yahoo smiley faces so I can see who is online on yahoo I want to be able to search my site to filter the members to only display those members that are signed in to yahoo messenger not to show the members of my site that are logged in to my site

    SO that on my on my search page I can have i am a _____ looking for a _________ and also have a field for show only people who are online yahoo

    Does anyone know how I could get this to work?

    Any help would be great

  3. php newb here as well 🙂

    your code inspired this:

    <?php
    $getstatus = file_get_contents(‘http://mail.opi.yahoo.com/online?u=westlacomputerservices&m=a&t=1’);
    switch($getstatus)
    {
    case “00”:
    $status = ”;
    break;
    case “01”:
    $status = ‘‘;
    break;
    }
    echo “Live chat is currently “.$status;
    ?>

  4. Woo…thats an interesting application of the code Chuck 🙂

    Have you tried the Yahoo! Pingbox here:
    http://messenger.yahoo.com/pingbox/

    I use it for my chats on the homepage. Its pretty useful and helps to show if our yahoo account is online or offline and integrates sitewide chat too. But does not help with invisible check of yahoo accounts. 🙂

  5. At this line:
    $check_it = “http://mail.opi.yahoo.com/online?u=[username]&m=a&t=1?;
    in the browser gives
    Parse error: syntax error, unexpected ‘:’ in /home/tulceavi/public_html/p5.php on line 3

  6. I found a bug for me! :|. “Parse error: syntax error, unexpected ‘:’ in /home/informat/public_html/gtsoft.ro/html.php on line 3” . Anybady can solve that?

  7. I hope I can get an answer here. From the comments it’s been a while since anyone has posted but I’m asking anyway. I wanted to know if your pHp code is saved in a php file or does it have to be incorporated into the sites index.html for it to work properly? And can I just do the buttons myself and put them on my server to acces them so I don’t have to count on a different site to stay up

Leave a Reply

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