|  | 
 
| 我是个初学者,请大家多多指教!!! 1.我的登陆实现了,但是没有准备的判断是否登陆成功步骤不会....
 2.登陆了之后想回帖的步骤,回帖的url跟回帖的cookie到底怎么获取......
 我用了飞哥的httphelper类,但是post之后返回的html既然是:{"message":"非礼勿用!","data":{},"code":"-1","success":0}.........
 先不说先贴代码。
 3.分析postdata数据是不是抓包工具抓到的可以直接使用?
 //发帖
 private void button2_Click(object sender, EventArgs e)
 {
 userName = this.txt_name.Text;
 passWord = this.txt_pwd.Text;
 string title = this.txt_title.Text;
 string content = this.txt_content.Text;
 #region  登陆
 HttpHelper http = new HttpHelper();
 HttpItem item = new HttpItem()
 {
 URL = "http://passport.tianya.cn/login",//URL     必需项
 Method = "post",//URL     可选项 默认为Get
 IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写
 Cookie = "",//字符串Cookie     可选项
 Referer = "http://www.tianya.cn/",//来源URL     可选项
 Postdata = string.Format("vwriter={0}&vpassword={1}&fowardURL=http%3A%2F%2Fmy.tianya.cn&returnURL=&from=&Submit=%E7%99%BB%E5%BD%95", userName, passWord),//Post数据     可选项GET时不需要写
 Timeout = 100000,//连接超时时间     可选项默认为100000
 ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000
 UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",//用户的浏览器类型,版本,操作系统     可选项有默认值
 ContentType = "application/x-www-form-urlencoded",//返回类型    可选项有默认值
 Allowautoredirect = false,//是否根据301跳转     可选项
 };
 HttpResult result = http.GetHtml(item);
 string html = result.Html;
 string cookie = result.Cookie;
 http = new HttpHelper();
 item = new HttpItem()
 {
 URL = "http://passport.tianyaclub.com/domain.jsp?cookieTime=1372319091&portalValue=&rightCookie=false&rmCookieCode=147098e0a627c9fa89b50573f005ae90&isActivatedUser=true&idWriter=22160228&writer=%E6%8B%89%E8%82%9A%E5%AD%90%E6%96%AF%E5%9F%BA&intKey=741873731&chvSysGradeList=null&sysGrade=null&domain=tianyaclub.com&flag=f0c19b76e5cea2fab3d438c08927af96&rmCode=true&rmFlag=1&wsid=DC2C4EDFE56BF840DB87DF02D637692A&r=1816781098",
 Encoding = Encoding.Default,
 Method = "get",
 Cookie = cookie
 };
 result = http.GetHtml(item);
 string h2 = result.Html;
 string cookie2 = result.Cookie;
 
 #endregion
 #region   回帖
 HttpHelper http2 = new HttpHelper();
 HttpItem item2 = new HttpItem()
 {
 URL = "http://bbs.tianya.cn/api?method=bbs.ice.reply",//URL     必需项
 Method = "post",//URL     可选项 默认为Get
 IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写
 Cookie = cookie2,
 //这是我直接在抓包工具提交评论复制的postdata
 Postdata = "params.artId=4301979¶ms.item=funinfo¶ms.appId=bbs¶ms.appBlock=funinfo¶ms.postId=4301979¶ms.preUrl=http%3A%2F%2Fbbs.tianya.cn%2Fpost-funinfo-4301979-1.shtml¶ms.preTitle=%E5%B0%8F%E5%A7%91%E5%AD%90%E8%A6%81%E4%B9%B0%E6%88%BF%E5%8F%91%E7%9F%AD%E4%BF%A1%E6%89%BE%E5%A5%B9%E5%93%A5%E5%80%9F%E9%92%B1%EF%BC%8C%E7%BB%93%E6%9E%9C%E7%9F%AD%E4%BF%A1%E8%A2%AB%E6%88%91%E7%9C%8B%E8%A7%81%E4%BA%86%EF%BC%8C%E8%AF%A5%E6%80%8E%E4%B9%88%E5%BA%94%E5%AF%B9%EF%BC%9F¶ms.preUserId=81627412¶ms.preUserName=%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC%E5%90%A72013¶ms.prePostTime=1372246500000¶ms.sourceName=%E5%A4%A9%E6%B6%AF%E8%AE%BA%E5%9D%9B¶ms.type=3¶ms.bScore=true¶ms.content=%E8%A7%86%E8%80%8C%E4%B8%8D%E8%A7%81¶ms.title=%E8%A7%86%E8%80%8C%E4%B8%8D%E8%A7%81¶ms.bWeiBo=false",
 Timeout = 100000,//连接超时时间     可选项默认为100000
 ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000
 UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",//用户的浏览器类型,版本,操作系统     可选项有默认值
 ContentType = "application/x-www-form-urlencoded; charset=UTF-8",//返回类型    可选项有默认值
 Allowautoredirect = true,//是否根据301跳转     可选项
 
 };
 HttpResult result2 = http2.GetHtml(item2);
 string html3 = result2.Html;
 string cookie3 = result2.Cookie;
 #endregion
 }
 
 
 | 
 |