[C#] 纯文本查看 复制代码
HttpItem item ;
string html="";
HttpResult result;
Msg1 s = new Msg1();
#endregion
#region 淘宝登录3步-第1步
do
{
//if (s.message == "为了您的账户安全,请输入验证码。" || s.message == "验证码错误,请重新输入。")
//{
// Response.Write("<script>window.showModelDialog('WebForm2.aspx')</script>");
//}
item = new HttpItem()
{
URL = "https://login.taobao.com/member/login.jhtml",
Method ="post",
Postdata =string.Format("ua=061tpOWUuXBidH1MRWQZ0InIldyJ0J3AibxJg%3D%3D%7CtaBkcTQxVCE0cTQBBIGUwRY%3D%7CtJFV4sZQBo%2BGTrafx%2B7KDiq%2Fm197DJR8NMy1jKh%2FqA%3D%3D%7Cs6aDR2N2MzZTJjN2MwYDhpPGY2aCh9Knktfy10InoveS52IXkhcz5A%3D%3D%7Csqcy9kF0sKWQVEEEwORdFD2kHYXtacHEcysChqJ1og%3D%3D%7CsTTw1PAn%7CsCXhxeE2%7Cv6q%2Fe8zoYClgaVD1AfU9xb0lzSlgeICosEislGy0QJjAGDBoQbV9hf1ljWnBSQDYEOUSimJrMnuMtDwkDTRsJfCp4Ihc2b3V%2FATcCcFoIClNdD2kbDThOaFJ0ehwqKFpMVWNFf1lbHRdRZCVUVSQlfHYgMhQeSEZUKf%2B1x%2FKQgtCSx86b1pMGD1oTSt%2FWg8qTIQtyYCYYEhQqEx0jFQAJXBVM%2FsDe%2BMLX3ovCmw4HUh9G39WvvYjNnN2E2ZzNnNWE4bj5oK74sofVn8mflqeup5Jng%3D%3D%7CvotP%2BN34rWnsyewoHQiNSWzpvHhtWC1IjPmMyQ0YLVg9%2BYzJnEuc%7CvaidWe7KvSXNhX0EPTlMaKyI%2F2mPi57bHxre2x8KTxo%2B6T4%3D%7CvKmsaEz7rpuOG26qbUlcGRx5DAmMidy5%2FIm8dXCUgbQhVMFUUTQRJDEUURQRZBHW8jYj9NAH%7Cu94arYkv2O%2F3n8ef108GE1ZTNkNWE1ZzJhNWAyfj9sMHAsbzpsPWAdY%3D%7Cuv%2F6%2Fzs%2B%2Bt8bDktemq%2F6j0sei086b6u%2Bq%2B4qP%2Fvui45K39oeO265&TPL_username=%E4%B8%83%E6%A0%BC%E6%A0%BC%E5%90%89%E7%A5%A5&TPL_password=3DES_2_000000000000000000000000000000_1D368DC6E81FE1E70809A8B69D65F085&TPL_username={0}&TPL_password={1}&TPL_checkcode={2}&loginsite=0&newlogin=1&TPL_redirect_url=http%3A%2F%2Flz.taobao.com%2Flogin%2F%3F&from=lzdp&fc=default&style=minisimple&css_style=&tid=XOR_1_000000000000000000000000000000_63583322450974020A07040D&support=000001&CtrlVersion=1%2C0%2C0%2C7&loginType=4&minititle=&minipara=0%2C0%2C0&umto=NaN&pstrong=&llnick=&sign=&need_sign=&isIgnore=&full_redirect=&popid=&callback=1&guf=¬_duplite_str=&need_user_id=&poy=&gvfdcname=10&gvfdcre=687474703A2F2F6C7A2E74616F62616F2E636F6D2F6C6F67696E2F3F7374617475733D30&from_encoding=&sub=true&allp=&oslanguage=&sr=1376*774&osVer=windows%7C6.1&naviVer=ie%7C9", HttpUtility.UrlEncode(UserName), HttpUtility.UrlEncode(UserPwd), CheckCode),
ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
Allowautoredirect =true,
ResultCookieType =ResultCookieType.CookieCollection
};
result = m_Http.GetHtml(item);
cc = result.CookieCollection;
html = result.Html;
s = JsonConvert.DeserializeObject<Msg1>(html);
}
while (s.state == "False");
#endregion
if (s.data.token == null) return;
#region 淘宝登录3步-第2步
string token = s.data.token;
item = new HttpItem()
{
URL = string.Format("https://passport.alipay.com/mini_apply_st.js?site=0&token={0}&callback=vstCallback77", token),
Accept = "application/javascript, */*;q=0.8",
ResultCookieType =ResultCookieType.CookieCollection,
CookieCollection = cc//result.CookieCollection
//Cookie=cookies
};
result = m_Http.GetHtml(item);
//cookies += result.Cookie;
for (int i = 0; i < result.CookieCollection.Count; i++)
{
cc.Add(result.CookieCollection[i]);
}
html = result.Html;
#endregion
Match st = Regex.Match(html, "(?<=\"st\":\").*?(?=\")");
if (st.Success == false) return;
#region 淘宝登录3步-第3步
item = new HttpItem()
{
URL = string.Format("https://login.taobao.com/member/vst.htm?st={0}¶ms=style%3Dminisimple%26sub%3Dtrue%26TPL_username%3D{1}%26loginsite%3D0%26from_encoding%3D%26not_duplite_str%3D%26guf%3D%26full_redirect%3D%26isIgnore%3D%26need_sign%3D%26sign%3D%26from%3Dlzdp%26TPL_redirect_url%3Dhttp%25253A%25252F%25252Flz.taobao.com%25252Flogin%25252F%25253F%26css_style%3D%26allp%3D&_ksTS=1406714434649_90&callback=jsonp91", st.Value, HttpUtility.UrlEncode("七格格吉祥")),
Accept = "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01",
ResultCookieType =ResultCookieType.CookieCollection ,
CookieCollection = cc//result.CookieCollection
//Cookie=cookies
};
result = m_Http.GetHtml(item);
for (int i = 0; i < result.CookieCollection.Count; i++)
{
cc.Add(result.CookieCollection[i]);
}
//cookies += result.Cookie;
html = result.Html;
#endregion
Match url = Regex.Match(html, "(?<=\"url\":\").*?(?=\")");
if (url.Success == false) return;
#region 跳转量子2步
item = new HttpItem()
{
URL = url.Value,
Accept = "text/html, application/xhtml+xml, */*",
ResultCookieType =ResultCookieType.CookieCollection ,
CookieCollection = cc//result.CookieCollection
};
result = m_Http.GetHtml(item);//1
html = result.Html;
for (int i = 0; i < result.CookieCollection.Count; i++)
{
cc.Add(result.CookieCollection[i]);
}
for (int i = 0; i < result.CookieCollection.Count; i++)
{
if (result.CookieCollection[i].Name == "lzsession")
{
lzsession = HttpUtility.UrlDecode(result.CookieCollection[i].Value);
this.ASPxTextBox2.Text = lzsession;
break;
}
}
item = new HttpItem()
{
URL = result.Header[HttpResponseHeader.Location],
Accept = "text/html, application/xhtml+xml, */*",
ResultCookieType = ResultCookieType.CookieCollection,
CookieCollection = cc//result.CookieCollection
};
result = m_Http.GetHtml(item);//2
for (int i = 0; i < result.CookieCollection.Count; i++)
{
cc.Add(result.CookieCollection[i]);
}
html = result.Html;
for (int i = 0; i < result.CookieCollection.Count; i++)
{
cc.Add(result.CookieCollection[i]);
}
#endregion
#region 进入量子获取数据接口
//item = new HttpItem()
//{
// URL = string.Format("http://api.linezing.com/=/view/itemsell/type/status?days=2014-07-30..2014-07-30&dtype=d&_s={0}=&_c=OR.C[10000]", lzsession),
// Accept = "text/html, application/xhtml+xml, */*",
// ResultCookieType = ResultCookieType.CookieCollection,
// CookieCollection = cc
//};
//result = m_Http.GetHtml(item);
//html = result.Html;
//Response.Write(html);
#endregion