не производится парсинг текста в h3, пробовал несколько вариантов, как я понял проблема в значении index элемента
<div class="photo">
<div class="img">
<div class="p10">
<a href="/upload/1.png"/></a></div>
<h3>текст</h3>
</div>
</div>
</div>
первый вариант
include_once ('components/simple_html_dom.php');
$html = new simple_html_dom();
$html = file_get_html('parser.html');
$tovar = $html->find('photo img ') as $tovar_img;
$tovar_img = $tovar->find('div.img p10 ', 0) as $tovar_p10;
$tovar_p10 = $tovar_img->find('div.p10 h3 ', 0) as $tovar_name;
echo $tovar_name;
второй вариант
include_once ('components/simple_html_dom.php');
$html = new simple_html_dom();
$html = file_get_html('parser.html');
$tovar = $html->find('div.photo', 0) -> find('div.img') -> find('div.p10') -> find('div.h3') as $tovar_name;
echo $tovar_name;
третий вариант
include_once ('components/simple_html_dom.php');
$html = new simple_html_dom();
$html = file_get_html('parser.html');
if(count($html->find('photo'))){
foreach($html->find('div.photo div.img div.p10 div.h3') as $h3){
echo $h3->plaintext.'<br>';
}
}
$tovar = $html->find('photo img ') as $tovar_img;
Зачем тутas
?