Esempio n. 1
0
        public static bool checkTaobaoLogin(string cookie)
        {
            bool   flag;
            string str = "";

            Directory.GetCurrentDirectory();
            string    str1      = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm";
            WebClient webClient = new WebClient();

            webClient.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
            webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36");
            webClient.Headers.Add("Accept-Encoding", "gzip,deflate,sdch");
            webClient.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
            webClient.Headers.Add("Cookie", cookie);
            byte[] numArray = webClient.DownloadData(str1);
            if (!"gzip".Equals(webClient.ResponseHeaders["Content-Encoding"]))
            {
                str  = Encoding.GetEncoding("GB2312").GetString(numArray);
                flag = false;
            }
            else
            {
                flag = (!CUtil.parseHtmlGzip(numArray, Encoding.GetEncoding("GB2312")).Contains("<title>已买到的宝贝</title>") ? false : true);
            }
            return(flag);
        }
Esempio n. 2
0
        public static bool checkAlimamaLogin(string cookie)
        {
            bool flag;
            bool flag1;

            try
            {
                string    str       = "http://pub.alimama.com/common/getUnionPubContextInfo.json";
                WebClient webClient = new WebClient();
                webClient.Headers.Add("Accept", "application/json, text/javascript, */*; q=0.01");
                webClient.Headers.Add("X-Requested-With", "XMLHttpRequest");
                webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36");
                webClient.Headers.Add("Referer", "http://pub.alimama.com/myunion.htm");
                webClient.Headers.Add("Accept-Encoding", "gzip,deflate,sdch");
                webClient.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
                webClient.Headers.Add("Cookie", cookie);
                string str1     = "";
                byte[] numArray = webClient.DownloadData(str);
                str1 = (!"gzip".Equals(webClient.ResponseHeaders["Content-Encoding"]) ? Encoding.UTF8.GetString(numArray) : CUtil.parseHtmlGzip(numArray, Encoding.UTF8));
                if (str1.Contains("\"noLogin\":true"))
                {
                    flag1 = false;
                }
                else
                {
                    flag1 = (!str1.Contains("status") ? true : !str1.Contains("wait"));
                }
                flag = (flag1 ? true : false);
            }
            catch
            {
                flag = false;
            }
            return(flag);
        }