[C#] 纯文本查看 复制代码 string username = "bb3690";//
string password = "Bb741741";
string Cookies = "";//
HttpItem itemSign = new HttpItem() //获取_sign
{
URL = "http://pc4.sss44.us/ssczs68949235f/user/login.html.auth",
};
HttpHelper http = new HttpHelper();
HttpResult httpresult = http.GetHtml(itemSign);
Cookies = httpresult.Cookie;
string FrameSrc = System.Uri.EscapeDataString(System.Text.RegularExpressions.Regex.Match(httpresult.Html, "(?<=var iframeSrc = \").*\"").Value.ToString().Replace("\"", ""));
HttpItem item = new HttpItem() //登陆Post
{
URL = "http://pc4.sss44.us/loginVerify/.auth",
Method = "POST",
Referer = "http://pc4.sss44.us/ssczs68949235f/user/login.html.auth",
ContentType = "application/x-www-form-urlencoded",
Postdata = string.Format("VerifyCode={0}&__VerifyValue={1}&__name={2}&password={3}&isSec={4}&cid={5}&cname={6}&systemversion={7}",
"38695", "dd35004bb22636454df42f4371358e0e07a8KSwxKysoLzAtMX5efn5efnYzODY5NQ", "bb3690", "Bb741741", "0", "1127", "金钻", "4_6")
};
HttpResult result = http.GetHtml(item);
System.Console.WriteLine(result.Html);
string[] sArray = result.Html.Split('\n');
string[] sCookie = result.Cookie.Split(';');
string phpsid = sCookie[3].Split(',')[1];
string ac = sCookie[4].Split(',')[1];
string rdessUrl = sArray[1].Replace("host", "pc4.sss44.us");
string cookie = phpsid + "; "+ ac;
item = new HttpItem()
{
URL = rdessUrl,//URL 必需项
Method = "get",//URL 可选项 默认为Get
//ContentType = "text/html",//返回类型 可选项有默认值
// Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
// Accept-Encoding = "gzip, deflate, sdch",
// Accept-Language = "zh-CN,zh;q=0.8",
Cookie = cookie,
Host= "pc4.sss44.us",
Referer = "http://pc4.sss44.us/ssczs68949235f/user/login.html.auth"
};
result = http.GetHtml(item);
System.Console.WriteLine(result.Html);
string redirectUrl = "http://pc4.sss44.us" + sArray[0] + "index.htm?20902_20903_4.6.trunk_20150316";
cookie = result.Cookie;
item = new HttpItem()
{
URL = redirectUrl,//URL 必需项
Method = "get",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
Cookie = cookie,
Referer = "http://pc4.sss44.us/ssczs68949235f/user/login.html.auth"
};
result = http.GetHtml(item);
System.Console.WriteLine(result.Html); |