php获取qq来访者脚本

<?php
//
class GetqqAction extends CommonAction {
    public function index(){
 
        //获取cookie文件,不存在创建,并退出程序
        $cookiefile= APP_PATH.'qq_cookie.txt';
 
        if(!file_exists($cookiefile))
        {
            echo 'qq_cookie.txt不存在,自动创建,请填写抓包的cookie<br>';
            file_put_contents($cookiefile,'');
            die('程序退出');
        }
        else //存在,读取cookie
        {
            $cookie=file_get_contents($cookiefile);//登录cookie
        }
 
        $qq= '23585472';
 
        $opts = array(
            'http'        => array(
            'method'    => "GET",
            'header'    => "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0rn" .
                           "Content-Type: application/x-javascript; charset=utf-8rn" .
                           "Referer: http://ctc.qzs.qq.com/qzone/v8/pages/visitors/refuse.htmlrn" .
                           "Cookie: pgv_pvid=8132596108; pgv_info=ssid=s2452991485; ptisp=ctc; ptui_loginuin=23585472; pt2gguin=o002358547222; RK=7hfKwDmB2k; ptcz=1c7189d301981626296363f488b8780f72d2cc3033b44d8e8ebddb66c8a0ec87; Loading=Yes; qzmusicplayer=qzone_player_23585472_1388733090176; qqmusic_uin=; qqmusic_key=; qqmusic_fromtag=; cpu_performance_v8=28; __Q_w_s__QZN_TodoMsgCnt=1; __Q_w_s__appDataSeed=1; uin=o0023585472; skey=@93r73lPiG rn"
          )
        );
 
        $g_tk = getGTK('@93r73lPiG');
 
        //mod = 0 最近访客
        //mod = 2 10内最近访客
        //mod = 8 30个被挡访客访客
        $url = "http://g.qzone.qq.com/cgi-bin/friendshow/cgi_get_visitor_simple?uin=".
               $qq . "&mask=2&clear=1&mod=8&fupdate=1&random=0.16096527734124544&g_tk=". $g_tk;
        $context = stream_context_create($opts);
 
        $html = file_get_contents($url, false, $context);
        $html = str_replace("_Callback(", '', $html);
        $html = substr($html, 0, -2);
        $html = json_decode($html, true);
    var_dump(date('Y-m-d H:i:s', '1387635603'));   
 
        if(is_array($html['data']['items']))
        {
            var_dump($html['data']['items']);
            $qq
        }
    '在线' = >整数0
              '黄色' = >整数-1
              “ supervip ' = >整数0
              ' src'中= >诠释32
              '国防部' = >诠释第8号
              '时间' = >整数1388225466
              '标志' = >整数0
              ' IMG ' = >
 
           /* 'uin' => int 839971162
              'name' => string '谁不希望你爱的人也爱你╮' (length=36)
              'online' => int 0
              'yellow' => int -1
              'supervip' => int 0
              'src' => int 32
              'mod' => int 8
              'time' => int 1388225466
              'flag' => int 0
              'img' => string 'http://qlogo3.store.qq.com/qzone/839971162/839971162/100?1365092094' (length=67)*/
 
 
        $this->display();
    }
 
 
}