本帖最后由 schmoll 于 2014-6-11 16:17 编辑
一直登录不成功。哪里有问题呢
[C#] 纯文本查看 复制代码 HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://kf.07073.com/company/member/login",//URL 必需项
Encoding = System.Text.Encoding.GetEncoding("GB2312"),//URL 可选项 默认为Get
Method = "POST",//URL 可选项 默认为Get
Referer = "",//来源URL 可选项
Cookie = null,
Postdata = "username=tm2b7v7&password=qq1234&remember=1",//Post数据
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
//UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Allowautoredirect = true,
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
ResultCookieType = ResultCookieType.CookieCollection,
};
HttpResult result = http.GetHtml(item); [C#] 纯文本查看 复制代码 item = new HttpItem()
{
URL = "http://kf.07073.com/company/manage/kfAdd",//URL 必需项
Encoding = System.Text.Encoding.GetEncoding(charset),//URL 可选项 默认为Get
Method = "get",//URL 可选项 默认为Get
Referer = "http://kf.07073.com/company/manage",//来源URL 可选项
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Allowautoredirect = true,
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
ResultCookieType = ResultCookieType.CookieCollection,
CookieCollection = result.CookieCollection,
};
HttpResult result2 = http.GetHtml(item);
|