I'm trying to parse the site, but the cat doesn't output anything
<?php
include_once 'simple_html_dom.php';
$html = file_get_html('https://teleprogramma.pro/headlines');
foreach($html->find('.text-part') as $element) {
echo $element->outertext;
}
?>
There are no Elements in the document which match the class .text-part
. You can look at the source code when you save the HTML into a file.
<?php
include_once 'simple_html_dom.php';
$html = file_get_html('https://teleprogramma.pro/headlines');
file_put_contents('htmlData.html', $html);
When you try for example to find .block-top-section-posts
you'll get a result.
<?php
include_once 'simplehtmldom_1_9_1/simple_html_dom.php';
$html = file_get_html('https://teleprogramma.pro/headlines');
foreach($html->find('.block-top-section-posts') as $element) {
echo $element->outertext;
}
// Outputs
/*
<div class="vue-container block-top-section-posts"> <div id="vuetag-top-section-posts" class="vue-tag news-line" data-url="/rest/term-additional-loading/section/76217/0/0" data-max-width="0" data-min-width="0" data-information=""> </div> </div>
*/
When you lookup the Site in a Browser you will get redirected to another URL. If you want to use that, have a look at php get url of redirect from source url to get the final address.