Yes, you can query Yahoo for anyone's online status. Here's a Perl script that I wrote ages ago (I don't know Perl much at all, so it's probably not ideal).
Code:
#!/www/perl/bin/perl
use LWP::Simple;
use URI::Escape;
# If no querystring provided (for username), exit.
if (length ($ENV{'QUERY_STRING'}) == 0) {
print "Content-type:text/html\n\n";
print "Please specify whose online status you want to check.";
exit;
}
# Yahoo! URL to query
$URL = "http://opi.yahoo.com/online?m=text&u=";
# Get username from querystring (lowercase and strip spaces)
$username = lc(uri_unescape($ENV{'QUERY_STRING'}));
$username =~ s/\s+//g;
# Fetch content from Yahoo!
$content = get($URL . $username);
# Begin output
print "Content-type:text/html\n\n";
if (index($content, "NOT ONLINE") == -1)
{
# Do something if user is online
print $username . " is ONLINE";
}
else
{
# Do something if user is offline
print $username . " is OFFLINE";
}