【问题标题】:extract dummy data through web scraping and php dom通过网页抓取和 php dom 提取虚拟数据
【发布时间】:2012-06-21 08:35:36
【问题描述】:

我想从下面给出的链接中提取虚拟数据

http://www.apsc.utoronto.ca/Calendars/2012-2013/Course_Descriptions.html#Course1

我已经能够获得课程代码和课程标题,但我无法检索课程描述,如果您在源代码中注意到,课程描述包含在表外的 <p> 中。 有什么想法我可以选择那个p吗?尝试了一些选择器,但我无法选择它。

我使用Parse Web Pages with PHP Simple HTML DOM Parser (David Walsh still suggesting it on June 15, 2011) 来选择和提取信息。

【问题讨论】:

    标签: web screen-scraping element selector simple-html-dom


    【解决方案1】:

    相对于表格:

    $xpath->query('./following-sibling::p[1]', $table)->item(0)->nodeValue
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-11-05
      • 1970-01-01
      • 1970-01-01
      • 2021-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多