【问题标题】:Symfony2 Crawler keeps returning Relocation PageSymfony2 Crawler 不断返回重定位页面
【发布时间】:2015-07-20 18:07:55
【问题描述】:

我正在尝试抓取一个网页,但这个特定页面不断返回包含 window.location.replace('web_address'); 的 if 和 else 语句,如果我执行 echo $crawler->html();,那么它实际上会将我的 Web 应用程序重定向到我的新网页'我实际上试图刮。

页面是 Salesforce。我不确定他们是否只是有某种机制,对任何传入的页面请求使用重定向。我能够安全地登录,但我无法检索实际的页面内容。

有没有人知道解决这个问题的方法,或者可能有不同的方法来做$client->request('GET', $link);

谢谢

(编辑:我在代码/爬虫中得到的实际回报)

if (this.SfdcApp && this.SfdcApp.projectOneNavigator) { 
    SfdcApp.projectOneNavigator.handleRedirect('https://company.my.salesforce.com?ec=302&startURL=%2Fhome%2Fhome.jsp'); 
} 
else if (window.location.replace) { 
    window.location.replace('https://company.my.salesforce.com?ec=302&startURL=%2Fhome%2Fhome.jsp'); 
} 
else { 
    window.location.href ='https://company.my.salesforce.com?ec=302&startURL=%2Fhome%2Fhome.jsp'; 
}

我该如何解决这个问题?我可以不只是以某种方式从 Salesforce 上的页面获取实际页面内容,还是会像这样抓取/goute/curl 返回重定向?

【问题讨论】:

    标签: php symfony web-scraping salesforce


    【解决方案1】:

    我的解决方案是只使用 RESTful API。

    Here's a super easy article how to do it using PHP.

    您需要一个 SalesForce Developer Edition 帐户才能创建 API 密钥。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-24
      • 1970-01-01
      • 2015-11-23
      • 2020-10-02
      • 2017-09-15
      • 1970-01-01
      • 2012-12-13
      • 2021-12-10
      相关资源
      最近更新 更多