Im newbie with DOM so can someone tell me how to parse the following in php?
<div class="classname1">
<div class="description">some description</div>
<div class="classname2">
<div class="classname3">some text 1</div>
<div class="classname4">some text 2</div>
<div class="classname6">some text 4</div>
</div>
</div>
I would like to retrieve the text in the above class. There could be mode div before and after the html mentioned. I know I should create a dom
$dom = new DOMDocument();
$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$divs = $xpath->query('//div[@class="classname1"]');
foreach ($divs as $div) {
//...
}
I dont know how to access the classnames data