Sunday, December 13, 2009

PHP code to check whether a yahoo user is online or not

$id="victim_id";
$url = 'http://opi.yahoo.com/online?u=';
$data = file_get_contents($url . $id);
if (trim(strtolower(strip_tags($data))) != 'user not specified.') {
echo (strlen($data) == 140) ? 'online' : 'offline'; }
else {
echo trim(strip_tags($data));
} ?>

No comments: