I am trying to parse the price $30 from the below microdata :
<div itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span itemprop="price"><strong>$30.00</strong></span></div>
here is the code I am trying to,but its throwing error Fatal error: Call to a member function find()
$url="http://somesite.com";
$html=file_get_html($url);
foreach($html->find('span[itemprop=price]') as $price)
echo $price;
any suggestions, where its going wrong?, or not sure how to parse with
You forgot calling the
str_get_html(YOUR_HTML)
function? orfile_get_html(YOUR_FILE)
If you didn't forget it, then probablt the missing single quotes in attribute values was the problem:
itemprop='price'
For a single product:
For all products:
You need to load the html into the simple-html-dom parser first. At the moment, your string is "http://www.somesite.com" -- not an actual page.