[C#] 纯文本查看 复制代码
public string Login_Automatic(string qqName, string Password, string Verify, ref string cookie)
{
string str = string.Empty;
str = "https://ssl.ptlogin2.qq.com/login?u=" + qqName + "&p=" + QQencryption.MD5_QQ_2_Encrypt(long.Parse(qqName), Password, Verify) +
"&verifycode=" + Verify + "&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&daid=164&from_ui=1&pttype=1&dumy=&fp=loginerroralert&action=3-0-6012&mibao_css=m_webqq&t=1&g=1&js_type=0&js_ver=10064&login_sig=qDlV*vNOKg*Fqxs-Y*SQ9V4bSTOLUPjq95ay8z0C1W*T5oS9LtJ4T674GEu72zt5";
item = new HttpItem()
{
URL = str,
//Postdata = str,
Method = "GET",
Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight-2-b1, */*",
Encoding = "utf-8",
ContentType = "application/x-www-form-urlencoded",
UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2; Alexa Toolbar; mxie; .NET CLR 1.1.4322)",
Cookie = cookie,
Allowautoredirect = false,
};
item.Headersadd("Accept-Encoding", "gzip, deflate, identity");
item.Headersadd("Accept-Language", "zh-CN");
HttpResult result = http.GetHtml(item);
cookie = result.Cookie;
Match mhtml = Regex.Match(result.Html, @"'(http://.+?)'");
string shtml = mhtml.Groups[1].Value;
if (String.IsNullOrEmpty(shtml)) return string.Empty;
HttpItem item1 = new HttpItem()
{
URL = shtml,
Method = "GET",
Accept = "text/html, application/xhtml+xml, */*",
ContentType = "application/x-www-form-urlencoded",
UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2; Alexa Toolbar; mxie; .NET CLR 1.1.4322)",
Cookie = cookie,
Allowautoredirect = false,
};
HttpHelper http1 = new HttpHelper();
HttpResult result1 = http1.GetHtml(item1);
//問題就在這裡。。這裡的cookie一直是空的。。
//問題就在這裡。。這裡的cookie一直是空的。正常是應該帶有p_skey和token的
cookie = result1.Cookie;
return result.Html;
}