<div class="replies"> <div class="comment"> <div class="pros">ТЕСТ 1</div> <div class="contras">ТЕСТ 2</div> <p>ТЕКС ТЕКСТТ ЕКС ТЕКСТ ТЕКС ТЕКСТ ТЕКС ТЕКСТ</p> </div> </div> 

How to remove the contents of the tag <p> </p> ?

 preg_match_all('/\<p\>(.+)\<\/p\>/isU', $content, $found3); 

It doesn’t fit because there are a lot of <p> tags on starnitsa, it’s necessary that you only take from the block

 <div class="replies"></div> 

    1 answer 1

    PHP Simple HTML DOM Parser . How to get HTML elements?

     // Create DOM from URL or file $html = file_get_html('http://www.google.com/'); // Find all images foreach($html->find('img') as $element) echo $element->src . '<br>'; // Find all links foreach($html->find('a') as $element) echo $element->href . '<br>'; 
    • +1: HTML parsing must be trusted by the parser. - VladD
    • simple html dom doesn't suit me ... - kotdg
    • foreach ($ html-> find ('div') as $ element) print_r ($ element); Warning: mb_strpos (): Offset not in string / ... / simple / simple_html_dom.php on line 1570 - kotdg