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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 36569|回复: 10

[HttpHelper] post提交数据后,返回的网页错误404怎么回事。

[复制链接]
发表于 2015-9-11 20:51:36 | 显示全部楼层 |阅读模式
30金钱

gethttp(lj, "post", tjxx, _a.cookie, false, "utf-8");
  这是代码,参数我反复查了很多遍都没错。不知道为什么效果和抓包的不一样,很无解,改写的都写了。每次获得的都是错误页面不是想要的内容。请飞哥大神们帮我看看。

public string gethttp(string urll, string Gp, string postda, string cook, bool ckjl, string bm)
        {
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = urll,//URL     必需项   
                Encoding = System.Text.Encoding.GetEncoding(bm),//URL     可选项 默认为Get   
                Method = Gp,//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Cookie = cook,//字符串Cookie     可选项   
                Referer = "",//来源URL     可选项   
                Postdata = postda,//Post数据     可选项GET时不需要写   
                Timeout = 100000,//连接超时时间     可选项默认为100000   
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值  
                ContentType = "application/x-www-form-urlencoded", //"text/html",//返回类型    可选项有默认值   
                Allowautoredirect = false,//是否根据301跳转     可选项   
                //CerPath = "d:\123.cer",//证书绝对路径     可选项不需要证书时可以不写这个参数   
                //Connectionlimit = 1024,//最大连接数     可选项 默认为1024                    ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数   
                //ProxyPwd = "123456",//代理服务器密码     可选项   
                //ProxyUserName = "administrator",//代理服务器账户名     可选项   
            };
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
            if (ckjl)
            {
                cookie = result.Cookie;
            }

            return html;
        }

这个是post提交数据后显示的页面

这个是post提交数据后显示的页面

这个是post提交数据的地址,好像是重定向的网页不知道怎么post.

这个是post提交数据的地址,好像是重定向的网页不知道怎么post.


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2015-9-11 21:16:20 | 显示全部楼层
提供抓包数据看看
回复

使用道具 举报

 楼主| 发表于 2015-9-12 17:20:04 | 显示全部楼层

C:\Documents and Settings\Administrator\桌面\抓包.jpg  
这个是POST抓包数据
回复

使用道具 举报

 楼主| 发表于 2015-9-12 17:21:51 | 显示全部楼层

这个是post 抓包数据飞哥看下。。

抓包数据。

抓包数据。
回复

使用道具 举报

发表于 2015-9-12 19:17:02 | 显示全部楼层
呵呵,这很难搞啊,有没有文本的,我比较懒,不喜欢对着图片一个一个的打
回复

使用道具 举报

 楼主| 发表于 2015-9-12 19:49:47 | 显示全部楼层
站长苏飞 发表于 2015-9-12 19:17
呵呵,这很难搞啊,有没有文本的,我比较懒,不喜欢对着图片一个一个的打

你要哪部分的文本我复制给你。
回复

使用道具 举报

 楼主| 发表于 2015-9-12 19:55:49 | 显示全部楼层
zhengwenlei001 发表于 2015-9-12 19:49
你要哪部分的文本我复制给你。

POST /auction/buynew/PurchaseOrderNew.aspx?BizOfferId=DB330-20150712-78917340 HTTP/1.1
Accept: application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/xaml+xml, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-xpsdocument, */*
Referer: http://danbao.5173.com/auction/b ... 0-20150712-78917340
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: danbao.5173.com
Content-Length: 4513
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: __utmc=12194411; trace_5173=201509121940c1d4183170cc4a9260d2; Hm_lpvt_6054b5813cf740e14dd8df8f5d0cb24b=1442058688; .5173auth=smLO3HyCdw6kVySaTD02/7IdU6L/OUvq+AdJDXwxY7DyxUETMTLGW9VwkWohpNRhEOH1PWX5rhP1/02fuRXmyKGPYFbDQ+C4ecpKiPP8xr1M1TVV8cdmHWVtlgxvrfY7sSFYLr3RGR/Q/qlC3I6/I1zFY5823eZadNTGVnijcfLwKDQLviaValuisUz2+Rs1jw7LYmWfdClcwPr9TqTpU92z9MJ86V5dDA4IFzCMJGC0SP0SjgtVEHba3+fZz9cZz+SDy+N66nsOpzJi0AA/ku/0g/IG7+VbQMNzAUQFtVxLe+N/AQIPztF/Gqk; nTalk_CACHE_DATA={uid:bq_1000_ISME9754_guest930602E6-57F0-67,tid:1442058186140767}; loop=0,635773041470858483; __utma=12194411.1070596341.1441679340.1442049164.1442058032.13; __utmz=12194411.1441679340.1.1.utmccn=(referral)|utmcsr=5173.com|utmcct=/|utmcmd=referral; Hm_lvt_6054b5813cf740e14dd8df8f5d0cb24b=1441926761,1441944373,1442049166,1442058034; _BFD=22370547; tma=260225609.25101682.1441679344312.1441926762437.1442049166984.4; tmd=99.260225609.25101682.1441679344312.; bfd_g=bffd842b2b4843320000609601256c9555c9a8f8; guide_payTips=s; NTKF_T2D_CLIENTID=guest930602E6-57F0-674C-3741-AAD628B08197; __vizrg=1; __vizsccnt=18|1457232225296; __utmv=12194411.zhengwenlei001; VH=44343b06076d4a7a95a0ef22aac481ae,2f4c229f6b074c9cae4ffdf9adcd7af6,Escort,DB330-20150712-78917340,+13%u6C38%u80DC%20%20%u9B3C%u5251%u58EB%2085%u7EA7%u7C89%u5DE8%u5251%20%20%u6781...,330.00|44343b06076d4a7a95a0ef22aac481ae,2f4c229f6b074c9cae4ffdf9adcd7af6,consignment,JS064-20150716-58828669,%u5168%u5957+10%2085cc%u677F%u7532%u5957%u3010%u795E%u5723%u7684%u5929%u9A6C%u5B88...,155.00|44343b06076d4a7a95a0ef22aac481ae,2f4c229f6b074c9cae4ffdf9adcd7af6,Escort,DB011-20150906-48004236,%20%u795E%u67AA%u624B%20%u300A+10%u91CA%u9B42%u4E4B%u771F%u7075%u5DE6%u8F6E%u300B%u5F3A%u5927%u653B...,299.00|44343b06076d4a7a95a0ef22aac481ae,2f4c229f6b074c9cae4ffdf9adcd7af6,Escort,DB172-20150815-65750073,%20%u589E%u5E45+10%u8840%u8165%u6740%u622E%u9879%u94FE%20%u9879%u94FE%2075%u7EA7%u7C89...,358.00; nprdC=6; cokGames=44343b06076d4a7a95a0ef22aac481ae; __utmb=12194411; bfd_s=260225609.81162891.1442058035015; tmc=17.260225609.35368028.1442058035093.1442058680234.1442058680250; __vizcnt=12|1442135599296; ASP.NET_SessionId=d1mxj502en4s3imqiggayh34


下面是返回的数据   返回源码中 有 OrderId=就对了。
HTTP/1.1 302 Found
Cache-Control: private
Content-Length: 110579
Content-Type: text/html; charset=gb2312
Location: http://danbao.5173.com/auction/P ... DB20150912715174061
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sat, 12 Sep 2015 11:51:45 GMT

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="http://danbao.5173.com/auction/Pay/GoPayfor.aspx?OrderId=DB20150912715174061">here</a>.</h2>
</body></html>
回复

使用道具 举报

 楼主| 发表于 2015-9-12 19:59:10 | 显示全部楼层
zhengwenlei001 发表于 2015-9-12 19:55
POST /auction/buynew/PurchaseOrderNew.aspx?BizOfferId=DB330-20150712-78917340 HTTP/1.1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eVNldmljZQUgUHVyY2hhc2VPcmRlck5ldzEkY2JBZ3JlZUxpY2Vuc2VnnD8r0iNfE8pfWJuiOMrCjT2XEw%3D%3D&SearchHeadNew1%24CommSearchBarNew5%24txtStuffCatagoryID=&SearchHeadNew1%24CommSearchBarNew5%24txtBizTypes=&SearchHeadNew1%24CommSearchBarNew5%24txtGameID=&SearchHeadNew1%24CommSearchBarNew5%24txtGameAreas=&SearchHeadNew1%24CommSearchBarNew5%24txtGameServers=&SearchHeadNew1%24CommSearchBarNew5%24txtGameBizType=&SearchHeadNew1%24CommSearchBarNew5%24txtSearchKeyWord=&SearchHeadNew1%24CommSearchBarNew5%24txtKeyword=%C7%EB%CA%E4%C8%EB%C8%CE%D2%E2%B9%D8%BC%FC%D7%D6&PurchaseOrderNew1%24hdGameMoney=&PurchaseOrderNew1%24hdPrice=330.0000&PurchaseOrderNew1%24hdDefFee=0.00&PurchaseOrderNew1%24QuantityInfo1%24ddlQuantity=1&PurchaseOrderNew1%24BuyerGameRoleInfo1%24txtGameRole=%B6%EC%B6%EC%B6%EC%B6%F6%B6%F6&PurchaseOrderNew1%24BuyerGameRoleInfo1%24txtGameRoleValidate=%B6%EC%B6%EC%B6%EC%B6%F6%B6%F6&PurchaseOrderNew1%24txtRoleGrade=99&PurchaseOrderNew1%24hide_VipKefuId=dbkf2055&PurchaseOrderNew1%24rdPostSaleGroup=rdNoPostSale&PurchaseOrderNew1%24txtBuyerTel=155****1948&PurchaseOrderNew1%24hdLastBuyerTel=155****1948&PurchaseOrderNew1%24txtBuyerQQ=16454545&PurchaseOrderNew1%24hdLastBuyerQQ=&PurchaseOrderNew1%24btnCreateOrder=%CC%E1%BD%BB%B2%E9%D1%AF%C4%DA%C8%DD&PurchaseOrderNew1%24cbAgreeLicense=on
回复

使用道具 举报

发表于 2015-9-12 20:37:53 | 显示全部楼层
zhengwenlei001 发表于 2015-9-12 19:59
提交数据忘记写上了是这个
0915324f09d34f42a6b45b9d4235a1ab=QnAaHRq%7Bline%7DC7lXaE7PYeFLOJW6W5ZooY ...

单纯从你复制的这些数据来说,没人帮得了你。
回复

使用道具 举报

 楼主| 发表于 2015-9-13 06:05:30 | 显示全部楼层
cload 发表于 2015-9-12 20:37
单纯从你复制的这些数据来说,没人帮得了你。

代码和数据我都提供了。 难道就没人懂了吗
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 02:34

© 2014-2021

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