一个判断oicq是否在线的小程序

发表于:2007-07-01来源:作者:点击数: 标签:
? // 呵呵,拿Alpha兄的那个i cq 版改的 function get_status($uin) { $fp = @fsockopen (infocenter.tencent.com, 80, $errstr, 30); if(!$fp) { return @#出错@#; } else { fputs($fp, GET /$uin/l/00/0/ HTTP/1.0\n\n); $do = @#yes@#; while(!feof($fp))
<?
// 呵呵,拿Alpha兄的那个icq版改的
function get_status($uin)
{  
    $fp = @fsockopen ("infocenter.tencent.com", 80, &$errno, &$errstr, 30);  
    if(!$fp)
    {  
        return @#出错@#;  
    }
    else
    {
        fputs($fp, "GET /$uin/l/00/0/ HTTP/1.0\n\n");  
        $do = @#yes@#;  
        while(!feof($fp))
        {
            $line = fgets ($fp,128);
            $do = ($do == @#yes@#)?@#yes@#:(eregi("^GIF89", $line))?@#yes@#:@#no@#;
            if($do == @#yes@#)
            {
                if(ereg("Online", $line))
                {
                    return @#在线@#;  
                }
                elseif(ereg("Offline", $line))
                {  
                    return @#没在线@#;  
                }
            }
            
        }
        fclose($fp);  
    }  
    return @#未知@#;  
}
$uin=@#1697313@#; //我自己的
echo get_status($uin);
?>   

原文转自:http://www.ltesting.net