2

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?

2
  • Waht have you tried yourself as a possible solution? Commented Nov 1, 2012 at 13:08
  • Please read through the editing FAQ to learn how to format your questions. Commented Nov 1, 2012 at 14:30

1 Answer 1

0

better if you use readability by Arc90 HTML content extractor

Sign up to request clarification or add additional context in comments.

1 Comment

ah! actually ama beginner so would u refer me any article or if possible any example? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.