I have the following html code:
<div class='class1'> Content 1
<div class='class2'> Content 2
</div>
</div>
And I want to use xpath to only get the content between 'class1' and 'class2', aka just 'Content 1' by itself. This is what I have so far:
$classname = 'class1';
$results = $xpath->query("//*[@class='" . $classname . "']");
echo $results->item($x)->nodeValue;
But its returning back
Content 1 Content 2
Anyway to just get 'Content 1' by itself? Thanks!