PHP – Get Yahoo Status

The given PHP example returns the current Yahoo status(online/offline) against a yahoo userid.

Code Example:
<?php
function yahoo($id){
    $url = 'http://opi.yahoo.com/online?u=';
    $data = file_get_contents($url . $id);
    if (trim(strtolower(strip_tags($data))) != 'user not specified.') {
        return (strlen($data) == 140) ? 'online' : 'offline';
    } else {
    return trim(strip_tags($data));
    }
    } 

echo yahoo("yahoo_userid");
?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

One Response to PHP – Get Yahoo Status

  1. avatar
    Wajhat on July 5, 2011 at 6:35 am

    Thank you!

Leave a Reply

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

*