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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 3687|回复: 3

[求助] 下载网站的K线数据,请问怎么post?

[复制链接]
发表于 2019-3-6 12:30:40 | 显示全部楼层 |阅读模式


      • Request URL:
        https://cn.investing.com/instruments/HistoricalDataAjax
      • Request Method:
        POST
      • Status Code:
        200 OK
      • Remote Address:
        58.68.229.173:443
      • Referrer Policy:
        no-referrer-when-downgrade

    • Response Headersview source
      • Accept-Ranges:
        bytes
      • Age:
        0
      • Cache-Control:
        no-store, no-cache, must-revalidate
      • Connection:
        keep-alive
      • Content-Encoding:
        gzip
      • Content-Length:
        2067
      • Content-Security-Policy:
        upgrade-insecure-requests; block-all-mixed-content
      • Content-Type:
        text/html; charset=UTF-8
      • Date:
        Tue, 05 Mar 2019 22:00:44 GMT
      • Expires:
        Thu, 19 Nov 1981 08:52:00 GMT
      • Pragma:
        no-cache
      • Server:
        nginx/1.14.0
      • Set-Cookie:
        ses_id=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=cn.investing.com
      • Vary:
        Accept-Encoding,User-Agent
      • Via:
        1.1 varnish
      • X-Powered-By:
        PHP/7.1.8
      • X-Varnish:
        2132773513

    • Request Headersview source
      • Accept:
        text/plain, */*; q=0.01
      • Accept-Encoding:
        gzip, deflate, br
      • Accept-Language:
        zh-CN,zh;q=0.9
      • Connection:
        keep-alive
      • Content-Length:
        190
      • Content-Type:
        application/x-www-form-urlencoded
      • Cookie:
        PHPSESSID=2qo7vvc5n23d8v0o9eu3c3qjvj; SideBlockUser=a%3A2%3A%7Bs%3A10%3A%22stack_size%22%3Ba%3A1%3A%7Bs%3A11%3A%22last_quotes%22%3Bi%3A8%3B%7Ds%3A6%3A%22stacks%22%3Ba%3A1%3A%7Bs%3A11%3A%22last_quotes%22%3Ba%3A1%3A%7Bi%3A0%3Ba%3A3%3A%7Bs%3A7%3A%22pair_ID%22%3Bs%3A5%3A%2224698%22%3Bs%3A10%3A%22pair_title%22%3Bs%3A0%3A%22%22%3Bs%3A9%3A%22pair_link%22%3Bs%3A20%3A%22%2Fequities%2Fair-canada%22%3B%7D%7D%7D%7D; geoC=CN; adBlockerNewUserDomains=1551823209; StickySession=id.12798334160.707cn.investing.com; _ga=GA1.2.2024766661.1551823218; _gid=GA1.2.841496107.1551823218; _gat=1; _gat_allSitesTracker=1; Hm_lvt_a1e3d50107c2a0e021d734fe76f85914=1551823218; __gads=ID=f46149f8a3cffd5a:T=1551823219:S=ALNI_MZbklvZdwl0YmGKxZVXurKoSH_bFQ; __qca=P0-82017016-1551823218759; billboardCounter_6=0; __atuvc=3%7C10; __atuvs=5c7ef171c8c1327c002; Hm_lpvt_a1e3d50107c2a0e021d734fe76f85914=1551823234; nyxDorf=ZGAzZDZ%2BYz00YGhkYC0xMmIyZDsyKzo5Njc0Mg%3D%3D
      • Host:
        cn.investing.com
      • Origin:
        https://cn.investing.com
      • Referer:
        https://cn.investing.com/equities/air-canada-historical-data
      • User-Agent:
        Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
      • X-Requested-With:
        XMLHttpRequest

    • Form Dataview parsed
      • curr_id=24698&smlID=1169236&header=AC%E5%8E%86%E5%8F%B2%E6%95%B0%E6%8D%AE&st_date=2019%2F02%2F03&end_date=2019%2F03%2F05&interval_sec=Daily&sort_col=date&sort_ord=DESC&action=historical_data


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2019-3-6 12:31:23 | 显示全部楼层
HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = "https://cn.investing.com/instruments/HistoricalDataAjax",//URL     必需项  
                Method = "POST",//URL     可选项 默认为Get  



                //Cookie = "PHPSESSID=2qo7vvc5n23d8v0o9eu3c3qjvj; SideBlockUser=a%3A2%3A%7Bs%3A10%3A%22stack_size%22%3Ba%3A1%3A%7Bs%3A11%3A%22last_quotes%22%3Bi%3A8%3B%7Ds%3A6%3A%22stacks%22%3Ba%3A1%3A%7Bs%3A11%3A%22last_quotes%22%3Ba%3A1%3A%7Bi%3A0%3Ba%3A3%3A%7Bs%3A7%3A%22pair_ID%22%3Bs%3A5%3A%2224698%22%3Bs%3A10%3A%22pair_title%22%3Bs%3A0%3A%22%22%3Bs%3A9%3A%22pair_link%22%3Bs%3A20%3A%22%2Fequities%2Fair-canada%22%3B%7D%7D%7D%7D; geoC=CN; adBlockerNewUserDomains=1551823209; StickySession=id.12798334160.707cn.investing.com; _ga=GA1.2.2024766661.1551823218; _gid=GA1.2.841496107.1551823218; _gat=1; _gat_allSitesTracker=1; Hm_lvt_a1e3d50107c2a0e021d734fe76f85914=1551823218; __gads=ID=f46149f8a3cffd5a:T=1551823219:S=ALNI_MZbklvZdwl0YmGKxZVXurKoSH_bFQ; __qca=P0-82017016-1551823218759; billboardCounter_6=0; __atuvc=3%7C10; __atuvs=5c7ef171c8c1327c002; Hm_lpvt_a1e3d50107c2a0e021d734fe76f85914=1551823234; nyxDorf=ZGAzZDZ%2BYz00YGhkYC0xMmIyZDsyKzo5Njc0Mg%3D%3D",//字符串Cookie     可选项  
                UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36",//用户的浏览器类型,版本,操作系统     可选项有默认值  
                Accept = "text/plain, */*; q=0.01",//    可选项有默认值  


                Allowautoredirect = false,//是否根据301跳转     可选项  
                AutoRedirectCookie = true,//是否自动处理Cookie     可选项  
                                          //CerPath = "d:\123.cer",//证书绝对路径     可选项不需要证书时可以不写这个参数  
                                          //Connectionlimit = 1024,//最大连接数     可选项 默认为1024  
                Postdata = "curr_id=24698&smlID=1169236&header=AC%E5%8E%86%E5%8F%B2%E6%95%B0%E6%8D%AE&st_date=2019%2F02%2F03&end_date=2019%2F03%2F05&interval_sec=Daily&sort_col=date&sort_ord=DESC&action=historical_data",//Post数据     可选项GET时不需要写  
                                                                                                                                                                                                                            //ProxyIp = "192.168.1.105:2020",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数  
                                                                                                                                                                                                                            //ProxyPwd = "123456",//代理服务器密码     可选项  
                                                                                                                                                                                                                            //ProxyUserName = "administrator",//代理服务器账户名     可选项  
                ResultType = ResultType.String,//返回数据类型,是Byte还是String  
            };
            item.Header.Add("Origin", " https");//设置请求头信息(Header)  
            item.Header.Add("Accept-Encoding", " gzip");//设置请求头信息(Header)  
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
            string cookie = result.Cookie;

            MessageBox.Show(html);
 楼主| 发表于 2019-3-6 12:32:34 | 显示全部楼层
请问POST怎么写?
发表于 2019-3-6 12:45:32 | 显示全部楼层
就是你写的这种格式,就看你组织的参数对不对的问题
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-3-29 19:22

© 2014-2021

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