【问题标题】:How can I read an html page and convert its content to xml to read the content?如何读取 html 页面并将其内容转换为 xml 以读取内容?
【发布时间】:2019-11-30 07:31:39
【问题描述】:

我有一个指向 html 页面的链接——一个博客页面——我想从 php laravel 代码中读取它的内容并从中提取一些数据字段。

页面应该是这样的: https://www.mashvisor.com/blog/san-francisco-real-estate-market-worth-it/

我正在使用 Laravel 5.0 来执行此操作。如何提取作者和标题等字段?

【问题讨论】:

标签: php xml laravel parsing html-parsing


【解决方案1】:

由于您要从中获取数据的站点是 Wordpress,因此只需使用可用的 api。它以 json 格式提供您要查找的数据。

https://www.mashvisor.com/blog/wp-json/wp/v2/posts

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-09
    • 1970-01-01
    • 2021-02-14
    • 2013-05-03
    • 2011-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多