Functie php pentru yahoo messenger availability

Poate mai ii trebuie cuiva 🙂

function isOnlineOnYahoo($yahoo_id, $timeout = 3) {
if (empty($yahoo_id)) {
return false;
}

$fbuf = “”;

$old = ini_set(‘default_socket_timeout’, $timeout);
$stath = @fopen(‘http://opi.yahoo.com/online?u=’.$yahoo_id.’&m=a&t=1′, ‘r’);
ini_set(‘default_socket_timeout’, $old);

if (is_resource($stath)) {
stream_set_timeout($stath, $timeout);
stream_set_blocking($stath, 0);

while (!feof($stath)) {
$fbuf .= fread($stath, 1024);
}

fclose($stath);
}

return ($fbuf == “01” ? true : false);
}

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.