Answer the question
In order to leave comments, you need to log in
Why does phpQuery only find one child element?
There is a certain page and from it I want to pull out all the li.spisok elements from this block:
Here is the code with which I am trying to get these elements:
require 'phpQuery.php';
$url = 'https://svmed.spb.ru/spisok/';
$file = file_get_contents($url);
$document = phpQuery::newDocument($file);
$li = $document->find('ul.container > li.spisok');
echo $li;
Answer the question
In order to leave comments, you need to log in
$all_li= $document->find('li.spisok');
foreach ($all_li as $li) {
echo $li;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question