Just get the text()
of em
element:
//div[@class='ProductPriceRating']/em/text()
Here's what you would have for $price
:
$price = trim($tmp_xpath->query("//div[@class='ProductPriceRating']/em/text()")->item(0));
Or, as @adamretter noted, better use normalize-space()
instead of trim()
:
$price = $tmp_xpath->query("normalize-space(//div[@class='ProductPriceRating']/em/text())")->item(0);