title: Php cURL Web Scraping
body: <p>I want to scrape the Price of the mobile phone from the website url : <a href="http://www.flipkart.com/apple-iphone-5s/p/itmdv6f75dyxhmt4?pid=MOBDPPZZDX8WSPAT" rel="nofollow">http://www.flipkart.com/apple-iphone-5s/p/itmdv6f75dyxhmt4?pid=MOBDPPZZDX8WSPAT</a></p>
  
  <p>If you view the code, the price is placed in the following SPAN</p>
  
  <pre><code>&lt;div class="pricing line"&gt;
          &lt;div class="prices" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer"&gt;
                      &lt;div&gt;
                          &lt;span class="selling-price omniture-field" data-omnifield="eVar48" data-eVar48="37500"&gt;Rs. 37,500&lt;/span&gt; // Fetch this price
                      &lt;/div&gt;
                      &lt;span class="sticky-message"&gt;Selling Price&lt;/span&gt;
              &lt;meta itemprop="price" content="37,500"&gt; 
              &lt;meta itemprop="priceCurrency" content="INR"&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My code to fetch this so far is :</p>
  
  <pre><code>&lt;?php
  $curl = curl_init('http://www.flipkart.com/apple-iphone-5s/p/itmdv6f75dyxhmt4?pid=MOBDPPZZDX8WSPAT');
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
  
  $page = curl_exec($curl);
  
  if(!empty($curl)){ //if any html is actually returned
  
      $pokemon_doc-&gt;loadHTML($curl);
      libxml_clear_errors(); //remove errors for yucky html
  
      $pokemon_xpath = new DOMXPath($pokemon_doc);
  
      //get all the h2's with an id
      $pokemon_row = $pokemon_xpath-&gt;query('//h2[@id]');
  
      if($pokemon_row-&gt;length &gt; 0){
          foreach($pokemon_row as $row){
              echo $row-&gt;nodeValue . "&lt;br/&gt;";
          }
      }
  }
  
  else
      print "Not found";
  ?&gt;
  </code></pre>
  
  <p>This shows an error :</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function loadHTML() on a non-object in
    D:\xampp\htdocs\jiteen\php-scrape\phpScrape.php on line 9</p>
  </blockquote>
  
  <p>What shall I do, I can't trace the error</p>