登陆苏宁提示 本次请求并未返回任何数据" 不知道哪里错了,请帮忙看下
[C#] 纯文本查看 复制代码 HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "https://passport.suning.com/ids/login",//URL 必需项
Method = "get",//URL 可选项 默认为Get
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "",//字符串Cookie 可选项
Referer = "",//来源URL 可选项
Postdata = "",//Post数据 可选项GET时不需要写
Timeout = 30000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Allowautoredirect = false,//是否根据301跳转 可选项
//CerPath = "d:\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数
//Connectionlimit = 1024,//最大连接数 可选项 默认为1024
ProxyIp = "",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数
//ProxyPwd = "123456",//代理服务器密码 可选项
//ProxyUserName = "administrator",//代理服务器账户名 可选项、
ResultCookieType = ResultCookieType.CookieCollection,
ResultType = ResultType.String
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
CookieCollection cookieColl = result.CookieCollection;
string Redirect = Regex.Match(result.Html, "(?<=highRiskRedirectFlag.*?value=')[\\w]+").Value;
string LoginChannel = Regex.Match(result.Html, "(?<=loginChannel.*?value=\")[\\d]+").Value;
string LoginTheme = "defaultTheme";
string Oauth_redirect = "";
string SecPassword = "";
string Service = "";
string Trust_redirect = "";
string UUID = Regex.Match(result.Html, @"uuid.*value=.(.*?)\/>", RegexOptions.IgnoreCase).Groups[1].Value.Replace("\"", "").Trim();
string VerifyCode = "";
item = new HttpItem()
{
URL = "https://passport.suning.com/ids/login",//URL 必需项
Method = "post",//URL 可选项 默认为Get
CookieCollection = cookieColl,
Referer = "https://passport.suning.com/ids/login",//来源URL 可选项
Postdata = string.Format("service=&uuid={0}&secPassword=&loginTheme={1}&highRiskRedirectFlag={2}&loginChannel={3}&oauth_redirect=&trust_redirect=&username={4}&password={5}&verifyCode=", UUID, LoginTheme, Redirect, LoginChannel, UserName, UserPwd),
// Postdata = "service=&uuid=6f0294da-c608-41c6-ae48-c274aa4e5113&secPassword=&loginTheme=defaultTheme&highRiskRedirectFlag=true&loginChannel=208000100010&oauth_redirect=&trust_redirect=&username=hqfikwz@163.com&password=hzwy0384&verifyCode=",
Timeout = 30000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
ContentType = "application/x-www-form-urlencoded",
ResultCookieType = ResultCookieType.CookieCollection,
ResultType = ResultType.String
};
result = http.GetHtml(item);
html = result.Html;
|