【问题标题】:scrape data from a url with file_get_contents ()使用 file_get_contents () 从 url 抓取数据
【发布时间】:2014-03-10 23:51:18
【问题描述】:

我正在尝试读取带有 file_get_contents() 的 URL。我只需要从页面中获取$invoice

$invoice 出现在类似于以下示例的句子中作为数字 789621 : paid <strong>789621</strong>

我该怎么做?

【问题讨论】:

    标签: php web-scraping file-get-contents


    【解决方案1】:

    您需要simple_html_dom 从页面抓取发票。 然后使用

    $ret = $html->find('div[id]');
    

    检索包含发票的 div。

    $content=$ret->innertext;
    

    给出该 div 的内容。休息很简单。只需将 $content 与 ' '(space) 分开并获取您的 $invoice

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-16
      • 2019-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-12
      • 2014-09-08
      • 2016-11-28
      相关资源
      最近更新 更多