http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 4288|回复: 6

[反馈建议] 反馈 使用 httphelper 1.45 版本 存在的问题

[复制链接]
发表于 2014-5-2 15:56:28 | 显示全部楼层 |阅读模式
此贴 存属于 问题 反馈   
反馈 使用 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;
            }
        }



更多图片 小图 大图
组图打开中,请稍候......

httphelper1.42.rar

89.29 KB, 下载次数: 34, 下载积分: 金钱 -1

1.42实例代码

httphelper1.45.rar

86.61 KB, 下载次数: 23, 下载积分: 金钱 -1

1.45实例代码



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2014-5-2 16:21:23 | 显示全部楼层
已经找到两个类的差别。。已解决。新人 可以下载学习哈。。。
发表于 2014-5-2 16:23:43 | 显示全部楼层
同样的代码,还是同样的代理啊,说清楚,如果是代理 问题请看升级报告,
http://www.sufeinet.com/thread-8424-1-1.html
1.4.5是需要设置的,如果是代码问题,这个我有时间检查下,  最重要是找到原因。

谢谢你的建议,我有时间检查下。

 楼主| 发表于 2014-5-2 16:26:37 | 显示全部楼层
感谢站长,已找到原因,是同样的代码。。
发表于 2014-5-2 18:29:20 | 显示全部楼层
wanliqiufeng 发表于 2014-5-2 16:26
感谢站长,已找到原因,是同样的代码。。

找到原因也和大家分享下啊。
 楼主| 发表于 2014-5-2 22:17:32 | 显示全部楼层
在1.45 中 需要 输入  加入  ContentType = "application/x-www-form-urlencoded",  1.42不需要。就是这个原因。才报错的。
 楼主| 发表于 2014-5-2 22:27:56 | 显示全部楼层
1.45 代码

[C#] 纯文本查看 复制代码
      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&quote=&threadid=9QV539UJ000915BF&hidename=false&username=&body=" + Utilities.UTF8(content) + "&isTinyBlogSyn=-1&flag=&validateCode=0",
                Cookie = cookie,
                ContentType = "application/x-www-form-urlencoded",
                ProxyIp = "ieproxy"
            };
            item.Header.Add("x-requested-with", "XMLHttpRequest");//请注意是否需要增加此项,但一般可省略
            result = http.GetHtml(item);
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-5-29 03:47

© 2014-2021

快速回复 返回顶部 返回列表