Answer the question
In order to leave comments, you need to log in
How to calculate the number of li?
$images = $pw->find('ul.lory-slider__list li');
$f = count($images);
Answer the question
In order to leave comments, you need to log in
You need the simple_html_dom.php library
1. curl to your page
2. use foreach to find the required ul list and count in it.
maybe there will be more than one foreach (depending on how difficult it is to get to the desired ul)
here is my piece of shit code as an example
$this->simple_html_dom( curl_exec($this->curl) );
$table = $this->result->find('table table', 2); // ******* Здесь таблица c Идентификаторами файлов (статус отчета)
$this->simple_html_dom( $table );
foreach($table->find('tr') as $key => $tr) {
if( $key < 7 ){
// Ищу ссылки, что бы их подменить и сделать валидными путем добавления
foreach($tr->find('a') as $a_href) {
//echo $a_href->href."</br>";
$a_href->href = "http://xxx.ru".$a_href->href; // Замена ссылки
}
$buf_table = $buf_table . $tr->outertext;
}
}
// Делаю это здесь т.к. по нормальному пока не получилось
$buf_table = str_replace("href", "target='_blank' href", $buf_table);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question