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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 13534|回复: 15

[求助] 百度贴吧POST操作超时

[复制链接]
发表于 2013-6-18 02:40:27 | 显示全部楼层 |阅读模式
  1.             HttpHelper http = new HttpHelper();
  2.             HttpItem item = new HttpItem()
  3.             {
  4.                 URL = "http://tieba.baidu.com/f/commit/post/add",
  5.                 Postdata = "ie=utf-8&kw=%E5%B2%9B%E5%B4%8E%E9%81%A5%E9%A6%99&fid=2904815&tid=2397024549&floor_num=3"e_id=34108051015&rich_text=1&tbs=e22c64b9d6b787171371486736&content=%E5%B9%B2%E4%BB%80%E4%B9%88%E7%9A%84&lp_type=0&lp_sub_type=0&new_vcode=1&tag=11&repostid=34108051015&anonymous=0",
  6.                 Method = "Post",
  7.                 ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
  8.                 Cookie = "SSUDBTSP=1369318934; BAIDUID=B2A3D0623A62F6111A3DE4936749C7B5:FG=1; BDUSS=",
  9.             };
  10.             HttpResult result = http.GetHtml(item);
  11.             string html = result.Html;
  12.             MessageBox.Show(html);
复制代码
返回操作超时   用E语言 一样的代码是可以POST的   站长大大看看 - -


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2013-6-18 02:41:55 | 显示全部楼层
可以GET 但是http://tieba.baidu.com/f/commit/ ... 549&floor_num=3"e_id=34108051015&rich_text=1&tbs=e22c64b9d6b787171371486736&content=%E5%B9%B2%E4%BB%80%E4%B9%88%E7%9A%84&lp_type=0&lp_sub_type=0&new_vcode=1&tag=11&repostid=34108051015&anonymous=0 直接这样改 提交不成功
 楼主| 发表于 2013-6-18 03:03:07 | 显示全部楼层
[code=csharp]POST /f/commit/post/add HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: zh-cn
Referer: http://tieba.baidu.com/p/2397024549
Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E)
Host: tieba.baidu.com
Content-Length: 272
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: SSUDBTSP=1369318934; BAIDUID=B2A3D0623A62F6111A3DE4936749C7B5:FG=1;

ie=utf-8&kw=%E5%B2%9B%E5%B4%8E%E9%81%A5%E9%A6%99&fid=2904815&tid=2397024549&floor_num=3&quote_id=34108051015&rich_text=1&tbs=e22c64b9d6b787171371486736&content=%E5%B9%B2%E4%BB%80%E4%B9%88%E7%9A%84&lp_type=0&lp_sub_type=0&new_vcode=1&tag=11&repostid=34108051015&anonymous=0[/code]

抓包数据
发表于 2013-6-18 06:40:07 | 显示全部楼层
x-requested-with: XMLHttpRequest加上这个头信息试试
 楼主| 发表于 2013-6-18 15:36:47 | 显示全部楼层
站长苏飞 发表于 2013-6-18 06:40
x-requested-with: XMLHttpRequest加上这个头信息试试

HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = "http://tieba.baidu.com/f/commit/post/add",
                Postdata = "ie=utf-8&kw=%E5%B2%9B%E5%B4%8E%E9%81%A5%E9%A6%99&fid=2904815&tid=2397024549&floor_num=3&quote_id=34108051015&rich_text=1&tbs=e22c64b9d6b787171371486736&content=%E5%B9%B2%E4%BB%80%E4%B9%88%E7%9A%84&lp_type=0&lp_sub_type=0&new_vcode=1&tag=11&repostid=34108051015&anonymous=0",
                ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
                UserAgent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E)",
                Referer="http://tieba.baidu.com/p/2397024549",
                Cookie="SSUDBTSP=1369318934; BAIDUID=B2A3D0623A62F6111A3DE4936749C7B5:FG=1;",
                Method="post",
            };
            item.Header.Add("x-requested-with", "XMLHttpRequest");
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
        }
    }


这样也不行

 楼主| 发表于 2013-6-18 15:39:52 | 显示全部楼层
站长苏飞 发表于 2013-6-18 06:40
x-requested-with: XMLHttpRequest加上这个头信息试试

QQ截图20130618153911.png

用在线工具是可以POST成功的。。。
 楼主| 发表于 2013-6-18 15:46:11 | 显示全部楼层
本帖最后由 try 于 2013-6-18 15:49 编辑
站长苏飞 发表于 2013-6-18 06:40
x-requested-with: XMLHttpRequest加上这个头信息试试

用在线测试工具生成的代码没有POSTDATA    添加上POSTDATA的话一样操作超时
发表于 2013-6-18 16:11:27 | 显示全部楼层
try 发表于 2013-6-18 15:46
用在线测试工具生成的代码没有POSTDATA    添加上POSTDATA的话一样操作超时

很明显是Post数据的问题,研究下是怎么生成Post数据的吧。
 楼主| 发表于 2013-6-18 16:49:19 | 显示全部楼层
站长苏飞 发表于 2013-6-18 16:11
很明显是Post数据的问题,研究下是怎么生成Post数据的吧。

。。 POST的数据能造成超时问题么

C#是刚接触 之前用E语言POST  一样的数据  是有返回的啊
发表于 2013-6-18 16:52:36 | 显示全部楼层
try 发表于 2013-6-18 16:49
。。 POST的数据能造成超时问题么

C#是刚接触 之前用E语言POST  一样的数据  是有返回的啊

数据不对,不Post数据正常,Post数据不正常,你说是那的问题,参数的值 不对

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-4-20 20:01

© 2014-2021

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