首页 > 开发 > PHP > 正文

判断ICQ是否在线的代码

2024-05-04 23:01:51
字体:
来源:转载
供稿:网友

//判断icq是否在线的代码  

<?   
function get_status($uin)
{   
    $fp = fsockopen ("wwp.icq.com", 80, &$errno, &$errstr, 30);   
    if(!$fp)
    {   
        echo "$errstr ($errno)<br> ";   
    }
    else
    {
        fputs($fp, "get /scripts/online.dll?icq=$uin&img=5 http/1.0 ");   
        $do = 'yes';   
        while(!feof($fp))  
        {
            $line = fgets ($fp,128);
            $do = ($do == 'yes')?'yes':(eregi("^gif89", $line))?'yes':'no';
            //echo $line;
             
            if($do == 'yes')
            {
                if(ereg("@", $line))
                {
                    return 'online';   
                }
                elseif(ereg("醱", $line))
                {   
                    return 'offline';   
                }
                elseif(ereg("s", $line))
                {
                    return 'disabled';   
                }
            }
             
        }
        fclose($fp);   
    }   
    return 'unknown!';   
}


$uin="72485936";  // sonymusic 的icq,呵呵。
echo get_status($uin);
// offline
?>   
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表