獲取在線人數 CNZZ 和 51.la


    string Cookies = string.Empty;

/// <summary> /// 獲取在線人數 (51.la統計器) /// </summary> /// <param name="siteid">站點ID</param> string TongJi_51La(string siteid) { HttpHelper http = new HttpHelper(); HttpItem item = new HttpItem() { URL = "http://www.51.la/report/1_main_online.asp?id=" + siteid, Cookie = "AJSTAT_ok_pages=1; AJSTAT_ok_times=1; ajid=lookpass%5F16680845=8444135851201a0b86b68c66ac8eabb3", ContentType = "application/x-www-form-urlencoded" }; HttpResult result = http.GetHtml(item); Match mc = Regex.Match(result.Html, "innerHTML = '(\\d+)"); return mc.Groups[1].Value; } /// <summary> /// 獲取在線人數 (CNZZ統計器) /// </summary> /// <param name="siteid">站點ID</param> /// <param name="pws">獨立密碼</param> /// <returns></returns> string TongJi_CNZZ(string siteid, string pws) { //萬能框架對象 HttpHelper http = new HttpHelper(); //獲取登錄頁面Cookie HttpItem item = new HttpItem() { URL = "http://new.cnzz.com/v1/login.php?siteid=" + siteid }; HttpResult result = http.GetHtml(item); Cookies = HttpHelper.GetSmallCookie(result.Cookie); //登錄 item = new HttpItem() { URL = "http://new.cnzz.com/v1/login.php?t=login&siteid=" + siteid, Method = "POST", Postdata = "password=" + pws, Cookie = Cookies, ContentType = "application/x-www-form-urlencoded", Allowautoredirect = true, AutoRedirectCookie = true }; result = http.GetHtml(item); Cookies += HttpHelper.GetSmallCookie(result.Cookie); //獲取15分鍾在線IP item = new HttpItem() { URL = "http://tongji.cnzz.com/main.php?c=flow&a=realtime&ajax=module=flash&type=Pie&siteid=" + siteid, Cookie = Cookies, ContentType = "application/x-www-form-urlencoded" }; result = http.GetHtml(item); Match mc = Regex.Match(result.Html, "total_ip\":(\\d+)"); return mc.Groups[1].Value; }

 

        /// <summary>
        /// 獲取在線人數 (CNZZ統計器)
        /// </summary>
        /// <param name="siteid">站點ID</param>
        /// <param name="pws">獨立密碼</param>
        /// <returns></returns>
        string TongJi_CNZZ(string siteid, string pws)
        {
            //萬能框架對象
            HttpHelper http = new HttpHelper();
            //登錄
            HttpItem item = new HttpItem()
             {
                 URL = "http://new.cnzz.com/v1/login.php?t=login&siteid=" + siteid,
                 Method = "POST",
                 Postdata = "password=" + pws,
                 ContentType = "application/x-www-form-urlencoded",
                 Allowautoredirect = true,
                 AutoRedirectCookie = true
             };
            HttpResult result = http.GetHtml(item);
            string Cookies = HttpHelper.GetSmallCookie(result.Cookie);
            //獲取15分鍾在線IP
            item = new HttpItem()
            {
                URL = "http://tongji.cnzz.com/main.php?c=flow&a=realtime&ajax=module=flash&type=Pie&siteid=" + siteid,
                Cookie = Cookies,
                ContentType = "application/x-www-form-urlencoded"
            };
            result = http.GetHtml(item);
            Match mc = Regex.Match(result.Html, "total_ip\":(\\d+)");
            return mc.Groups[1].Value;
        }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM