【问题标题】:How do I retrieve data from google using PHP如何使用 PHP 从谷歌检索数据
【发布时间】:2014-03-28 00:58:51
【问题描述】:

在 PHP 中,我想知道如何从 google 搜索中检索特定数据。例如,如果我想在https://www.google.com/#q=ps3&tbm=shop 上检索第一个结果的价格。我已经尝试过 curl 和 domdocs 并且不会去任何地方。

【问题讨论】:

    标签: php html dom curl xhtml


    【解决方案1】:

    在 PHP 中获取网页内容的最简单方法是使用 file_get_contents 函数。

    http://us2.php.net/file_get_contents

    获得数据后,您需要对其进行解析。有很多关于如何处理这个问题的好文章,所以我不会重复它们。这是一个好的链接:

    http://anchetawern.github.io/blog/2013/08/07/getting-started-with-web-scraping-in-php/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-25
      • 2012-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-11
      • 1970-01-01
      • 2023-03-19
      相关资源
      最近更新 更多