$html = new DOMDocument();
@$html->loadHtmlFile($url);
$xpath = new DOMXPath( $html );
//Query to pull all reviews on the page
$q="//div[starts-with(@id,empReview_)]/h3/meta[1]/@content";
$nodelist = $xpath->query($q);
foreach ($nodelist as $n){
echo $n->nodeValue;
echo"<br><br>";
}
Is the query I'm attempting to run on the following XML:
<div id="empReview_2055942" class="employerReview" itemscope="" itemtype="http://schema.org/Review">
<h2 class="summary">
<h3 class="review-microdata-heading">
<span class="gdRatingStars"> </span>
Former
<span itemprop="author">IT Engineer Intern in Santa Clarita, CA</span>
<meta content="4" itemprop="reviewRating"/>
It goes right to the element when using Firepath, but is not echoing the value via my query in php.
Any help would be greatly appreciated.