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=’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”);
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!!!

Related posts


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

16 Comments

Leave a Comment · TrackBack · RSS Comments

  1. Comment by shobankr on March 8, 2008

    Add a Google talkback gadget buddy!!! :)

  2. Comment by Anand on March 8, 2008

    ah, I started using gtalk only recently, that too for the mobme guys :lol: I love Yahoo! they rock . . .

  3. Comment by LOxEN on July 3, 2008

    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 ?

  4. Comment by mobo on November 12, 2008

    thanks ^.^

  5. Comment by Charis on November 13, 2008

    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

  6. Comment by Berita on December 3, 2008

    Thannks I have used it on site http://www.berita.me
    Thank You

  7. Comment by Kalin on February 15, 2009

    Cool Script!10x for share!

  8. Comment by chuck on February 18, 2009

    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;
    ?>

  9. Comment by Anand on February 18, 2009

    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. :)

  10. Comment by Nick on April 15, 2009

    It’s not working with yahoo ALIAS, anyone know a way get around it ?

  11. Comment by Vikram on May 5, 2009

    Thanks for the code

  12. Hi This was a great code that helped for one of my client.. Thanks Sachin

  13. Comment by remo on June 15, 2009

    Hello any one can provide me yahoo web messenger to my website please any one know can give me details

  14. Comment by jessica on June 28, 2009

    emena me aresi poli na milao ke to yahoo mu aresi poli\

  15. Comment by Chzero on May 31, 2010

    This is usefull for me as a newbie. Thank’s so much

  16. Comment by Paul on August 17, 2010

    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

Leave a comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes