<?php $filename = '/daily.txt'; namespace dark; include_once 'phpQuery.php'; class daily { public static function getHtml() { $html = file_get_contents('link'); $document = phpQuery::newDocument($html); $echo_elements = $document->find('.informer-content'); foreach ($echo_elements as $el) { $pq = pq($el); $pq->find('.block:lt(5)')->remove(); } } getHtml(); file_put_contents($fileName, $pq); } ?> I get nothing at the output, although if I do not declare a class and a function, everything works.
The value of the function should display the information I need, as I understood it. If I do it without a function, then simple print $pq; it helps me, but here is a blank page without errors in the console.
daily::getHtml()(it is better to name classes with a capital letter). And the last two lines must be removed from the class. And a little rewrite, because very porridge came out. - entithat