【问题标题】:How to edit contents grabbed using file_get_contents如何编辑使用 file_get_contents 抓取的内容
【发布时间】:2012-05-14 17:39:00
【问题描述】:

我通过使用 file_get_contents 获取了一些 url 和标题。现在我想编辑它们并显示在我的页面中。但我认为这是不可能的。

$html = file_get_html($gg_url);
// find all div tags with id=s
$ttt = $html->find('div.s');

结果是:

www.example.com and bla bla bla under that DIV

但该网址被标记为<cite>www.exaple.com</cite>

我所需要的只是结果中的 url,但整个内容(url + 其他文本)都在一个变量中。有没有办法得到那个网址?

【问题讨论】:

    标签: php html-parsing simple-html-dom


    【解决方案1】:
    $html = file_get_html($gg_url);
    $ttt = $html->find('cite')->innertext;
    echo $ttt;
    

    【讨论】:

      猜你喜欢
      • 2014-05-18
      • 1970-01-01
      • 1970-01-01
      • 2018-05-02
      • 2016-05-05
      • 2012-01-14
      • 1970-01-01
      • 2016-06-12
      • 1970-01-01
      相关资源
      最近更新 更多