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

Leave a Comment

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