title: domdocument loadhtml in php
body: <p>I am scraping one page to update the prices. Data is in table format. I don't want to scrap the whole table. I need to scrap the some rows only. It will defined by row's value. So i am comparing the row's value. But comparison isn't working. I am putting my code also. Here in code comparison is not working.I tried many times. Any lead will be appreciated.</p>
  
  <pre><code>&lt;?php
  // new dom object
  $dom = new DOMDocument();
  //load the html
  $html =                                                                         
  $dom-&gt;loadHTMLFile("http://example.com");
  //discard white space 
  $dom-&gt;preserveWhiteSpace = false; 
  //the table by its tag name
  $tables = $dom-&gt;getElementsByTagName('table'); 
  //get all rows from the table
  $rows = $tables-&gt;item(0)-&gt;getElementsByTagName('tr'); 
   foreach ($rows as $row) 
   { 
  
       // get each column by tag name
       $cols = $row-&gt;getElementsByTagName('td'); 
       $value = $cols-&gt;item(0)-&gt;nodeValue;
       if($value === "xyz")
       {
          // echo the values 
          echo $cols-&gt;item(1)-&gt;nodeValue.'&lt;br /&gt;'; 
          echo $cols-&gt;item(2)-&gt;nodeValue;
       }
   }
    ?&gt;
  </code></pre>