判断ICQ是否在线的代码
发布时间:2006-10-14 2:41:35   收集提供:gaoqian
//判断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
?>   

//作者/来源:Alpha.Z   

 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50