|
楼主 |
发表于 2013-5-27 20:03:11
|
显示全部楼层
public string Login(string qqName, string Password, string Verify, ref string cookie)
{
string str = string.Empty;
str += "u=" + qqName;
str += "&p=" + qqgetEncryption.getEncryption.GetPassword(uin, Password, Verify);
str += "&verifycode=" + Verify;
str += "&aid=4007203";
str += "&u1=" + System.Web.HttpUtility.UrlEncode("http://appmedia.qq.com/media/jslib/src/auth/loginsucc.html");
str += "&h=1";
str += "&ptredirect=0";
str += "&ptlang=2052";
str += "&from_ui=1";
str += "&dumy=";
str += "&low_login_enable=0";
str += "®master=";
str += "&fp=loginerroralert";
str += "&action=2-17-1369352762765";
str += "&mibao_css=";
str += "&t=1";
str += "&g=1";
str += "&js_ver=10031";
str += "&js_type=1";
item = new HttpItem()
{
URL = "http://ptlogin2.qq.com/login?" + 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 8.0; Windows NT 5.2; Trident/4.0; TencentTraveler 4.0; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E)",
Cookie = cookie
};
item.Headersadd("Accept-Encoding", "gzip, deflate");
item.Headersadd("Accept-Language", "zh-CN");
HttpResult result = http.GetHtml(item);
cookie = result.Cookie;
return cookie;
}
然后把cookie带入下面
public string Ceshi(string cookie)
{
item = new HttpItem()
{
URL = "http://iwan.qq.com",
//Postdata = str,
Method = "GET",
Accept = "*/*",
Encoding = "utf-8",
ContentType = "application/x-www-form-urlencoded",
UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; TencentTraveler 4.0; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E)",
Cookie = cookie
};
item.Headersadd("Accept-Encoding", "gzip, deflate");
item.Headersadd("Accept-Language", "zh-cn");
HttpResult result = http.GetHtml(item);
cookie = result.Cookie;
return result.Html ;
}
|
|