此贴 存属于 问题 反馈
反馈 使用 httphelper 1.45 版本 存在的问题
举例:
网易 登录 发帖 为例 , 同样的代理,使用 httphelper 1.42 ,可以成功发帖
而 使用 httphelper 1.45 则以失败告终
[C#] 纯文本查看 复制代码
public string LogOn(string username, string pwd)
{
string html = string.Empty;
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "https://reg.163.com/logins.jsp",
Method = "POST",
Referer = "http://reg.163.com/",
Postdata = string.Format("type=1&product=urs&url=&url2=http://reg.163.com/UserLogin.do&username={0}&password={1}", username, pwd),
ContentType = "application/x-www-form-urlencoded",
ResultCookieType = ResultCookieType.CookieCollection,
};
HttpResult result = http.GetHtml(item);
item = new HttpItem()
{
URL = "http://comment.tech.163.com/reply/dopost.jsp",
Method = "POST",
Accept = "*/*",
Expect100Continue = false,
Referer = "http://comment.tech.163.com/tech_bbs/9QV539UJ000915BF.html",
Postdata = "board=tech_bbs"e=&threadid=9QV539UJ000915BF&hidename=false&username=&body=" + Utilities.UTF8(this.textBox5.Text) + "&isTinyBlogSyn=-1&flag=&validateCode=0",
Cookie = result.Cookie,
};
item.Header.Add("x-requested-with", "XMLHttpRequest");//请注意是否需要增加此项,但一般可省略
result = http.GetHtml(item);
if (result.Html == null)
{
return "发帖成功";
}
else
{
return result.Html;
}
}
|