The given PHP example returns the current Yahoo status(online/offline) against a yahoo userid.
<?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" ); |
?>
No comments:
Post a Comment