朋友网关于QQ相关的PHP代码(研究QQ的绝佳资料)(3)

function getOnlineList()
    {
        //得到在线好友列表
        //VER=1.1&CMD=Query_Stat&SEQ=&UIN=&TN=50&UN=0
        $str = "VER=1.1&CMD=Query_Stat&SEQ=".rand(1000,9000)."&UIN=".$this->uin."&TN=50&UN=0";
        $return = $this->encode($this->query($str));
        if($return['RES']==0 and $return['UIN'] == $this->uin)
        {
            //返回成功
            if($return['SN'] > 0)
            {
                //在线好友数>0
                $uns = $this->split_str($return['UN']);    //号码列表
                $nks = $this->split_str($return['NK']); //昵称列表
                $sts = $this->split_str($return['ST']); //状态列表
                $fcs = $this->split_str($return['FC']); //头像列表
                $error = 0;
                ((count($uns)==count($nks))==(count($sts)==count($fcs)))==(count($nks)==count($sts)) ?
                    $num = count($uns)
                    :
                    $error = 1;
                ;
                if($error == 1) return QQ_LIST_ERROR;
                $arr = array();
                for($i=0;$i<$num;$i++)
                {
                    $arr[] = array(
                        "UN" => $uns[$i] ,
                        "NK" => $this->utf8_to_gb2312($nks[$i]) ,
                        "ST" => $sts[$i] ,
                        "FC" => $fcs[$i]
                    );
                }
                return ($arr);
            }
            else
            {
                //在线好友数<=0
                return QQ_LIST_NONE;
            }
           
        }
        else
        {
            //返回失败
            return QQ_RETURN_FAILED;
               
        }
    }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/e7cf048b808aaaaf76e4422e219f844a.html