for my layout, too, flies.$content = preg_replace("/<\/?div[^>]*\>/i", "", $content);
does not work... Can anyone come across?$url = 'http://yandex.ru';
$result = file_get_contents($url);
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
/* By default loadHTML uses iso-8859-1, so explicitly specify the conversion */
$dom->loadHTML(mb_convert_encoding($result, 'HTML-ENTITIES', 'UTF-8'));
libxml_use_internal_errors(false);
$bodyContent = $dom->getElementsByTagName('body')[0]->textContent;
Find more questions by tags PHPParsingRegular expressions