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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 14216|回复: 4

[求助] 远程服务器返回错误: (502) 错误的网关。

[复制链接]
发表于 2015-9-9 13:42:50 | 显示全部楼层 |阅读模式
求助, 爬取http://www.peugeot.com.au/find-a-dealer 的时候,post了一个4000的邮编,
从浏览器里能看到XHR显示返回的内容,但是用爬虫抓取就会返回The remote server returned an error: (502) Bad Gateway.

请问飞哥怎么回事??
@站长苏飞



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2015-9-9 13:51:47 | 显示全部楼层
这网站超级慢,你提供下抓包数据和代码,看下情况
 楼主| 发表于 2015-9-9 13:58:02 | 显示全部楼层
本帖最后由 handler 于 2015-9-9 14:01 编辑
站长苏飞 发表于 2015-9-9 13:51
这网站超级慢,你提供下抓包数据和代码,看下情况

抓包数据
General


    • Remote Address:
      10.140.1.110:8080
    • Request URL:
      http://www.peugeot.com.au/find-a-dealer/
    • Request Method:
      POST
    • Status Code:

      200 OK
  • Response Headersview source
    • Age:
      0
    • Cache-Control:
      no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    • Connection:
      keep-alive
    • Content-Type:
      application/json
    • Date:
      Wed, 09 Sep 2015 05:23:56 GMT
    • Expires:
      Thu, 19 Nov 1981 08:52:00 GMT
    • Pragma:
      no-cache
    • Set-Cookie:
      sid=b0629df249f31c35a05b7d81519c10156155a597; path=/
    • Transfer-Encoding:
      chunked
    • X-Cache:
      MISS from MELSQUID110
    • X-Cache:
      MISS from SHGSQUID110
    • X-Cache-Lookup:
      MISS from SHGSQUID110:8080
    • X-Cache-Lookup:
      MISS from MELSQUID110:8080
    • X-UA-Compatible:
      IE=edge
    • X-Varnish:
      1074687279
  • Request Headersview source
    • Accept:
      application/json
    • Accept-Encoding:
      gzip, deflate
    • Accept-Language:
      zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4,ja;q=0.2,pt-BR;q=0.2,pt;q=0.2
    • Cache-Control:
      no-cache
    • Content-Length:
      94
    • Content-type:
      application/x-www-form-urlencoded; charset=UTF-8
    • Cookie:
      sid=b0629df249f31c35a05b7d81519c10156155a597
    • DNT:
      1
    • Host:
      www.peugeot.com.au
    • Origin:
      http://www.peugeot.com.au
    • Pragma:
      no-cache
    • Proxy-Connection:
      keep-alive
    • Referer:
      http://www.peugeot.com.au/find-a-dealer/
    • User-Agent:
      Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
    • X-Request:
      JSON
    • X-Requested-With:
      XMLHttpRequest
  • Form Dataview sourceview URL encoded
    • type:
      address
    • geofindlat:
    • geofindlng:
    • geoloc:
    • main_search:
      4000
    • name_search:
    • range:
      300
    • ajax:
      true






NamePath





[tr=rgb(212, 212, 212)][/tr]





代码
[C#] 纯文本查看 复制代码
                 HttpHelper httpHelper = new HttpHelper();                HttpItem item = new HttpItem()
                {
                    Method = "post",
                    URL = "http://www.peugeot.com.au/find-a-dealer/",
                    Postdata = "type=address&geofindlat=&geofindlng=&geoloc=&main_search=4000&name_search=&range=300&ajax=true",
                    Encoding = Encoding.UTF8,
                    ProxyIp = "tkysquid110:8080",
                    Referer = "http://www.peugeot.com.au/find-a-dealer/",
                    UserAgent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36",
                    //ResultType="JSON"

                };

                 collectedPageStr = httpHelper.GetHtml(item).Html;


发表于 2015-9-9 14:03:46 | 显示全部楼层
tkysquid110:8080 这地址不对吧。
 楼主| 发表于 2015-9-9 14:13:07 | 显示全部楼层
站长苏飞 发表于 2015-9-9 14:03
tkysquid110:8080 这地址不对吧。

这是公司的代理,如果不用代理就直接返回 Unable to connect to the remote server
改成了10.140.1.110:8080, 也是(502) Bad Gateway.
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-5-4 10:24

© 2014-2021

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