Dynamically Exclude Content In PHP Simple HTML DOM Parser

I am making a PHP-based application which will fetch content from a site using the PHP Simple HTML DOM Parser.

I want to exclude some text between two HTML tags from the content dynamically.

If the source code of the content is:

Some description or content ETC ABC <span class="s"> May 3  2009 <b> ABC Some Text </b> Some photo or video...

I want to remove all the text wrapped by <span class="s"> to the first <b> HTML tag, so the output will be:

Some description or content ETC ABC <span class="s"><b> ABC Some Text </b> Some photo or video...

This should done using a foreach loop and, the idea is, to get all the filtered text in a variable like $ftext and then have to apply some simple PHP like:

foreach($html->find('how_to_tell_those_filtered_text_here') as $ftext)
$result = str_replace($ftext, '', $result);
$result = str_get_html($result);

So, what should be the solution, any idea?


您可以阅读这篇文章PHP Port of Arc90的可读性能够帮助您了解Arc 90的可读性。


如果您使用Arc90 HTML内容提取器的可读性更好

链接地址: http://www.djcxy.com/p/29856.html

上一篇: PHP简单的HTML DOM解析器添加脚本标记

下一篇: 动态排除PHP简单HTML DOM解析器中的内容