title: Need to scrape price from an ecommerce website using xpath
body: <p>I need to extract the price of a specific product from an e-commerce website using Dom and XPath and save it to a MySQL database.</p>
  
  <p>I have tried</p>
  
  <pre><code>&lt;?php
  $html = new DOMDocument();
  @$html-&gt;loadHtmlFile('http://www.flipkart.com/samsung-galaxy-star-pro-s7262/p/itmdqq6zfh7y7enm?pid=MOBDQ22YUJ8ZFXKW&amp;srno=b_1&amp;ref=0545bfb1-043b-479f-aca2-a468e03f0c34');
  $xpath = new DOMXPath( $html );
  *$nodelist = $xpath-&gt;query("id('topsection')/x:div[3]/x:div[2]/x:div[1]/x:div/x:div[1]/x:div/x:span");*
  foreach ($nodelist as $n){
  echo $n-&gt;nodeValue."\n";
  }
  ?&gt;
  </code></pre>
  
  <p>This code works for things like getting the urls, page title etc.</p>
  
  <p>But when I tried using it to get price from that particular url using xpath, it got nothing.What could possibly be wrong?</p>