title: PHP simple_html_dom extract data from url
body: <p>What is the problem with my code? Why it doesn't work?</p>
  
  <p>This is my code that i tried to use:</p>
  
  <pre><code>function extract_data($url){
  
      // Create DOM from URL
      $html = file_get_html($url);
  
      // initialize empty array to store the data array from each row
      $theData = array();
  
      // loop over rows
      foreach($html-&gt;find('p.ch_title') as $row) {
  
          // initialize array to store the cell data from each row
          $rowData = array();
          foreach($row-&gt;find('p.ch_spec') as $cell) {
  
              // push the cell's text to the array
              $rowData[] = $cell-&gt;innertext;
          }
  
          // push the row's data array to the 'big' array
          $theData[] = $rowData;
      }
  
      return $theData;
  
  }
  </code></pre>
  
  <p>and this is the html data from the url;</p>
  
  <pre><code>&lt;div class="holder-specificatii"&gt;
         &lt;div class="box-specificatie"&gt;
            &lt;div class="ch_group"&gt;Dimensiuni&lt;/div&gt;
            &lt;p class="ch_title"&gt;Latime (mm):&lt;/p&gt;
            &lt;p class="ch_spec"&gt;195&lt;/p&gt;
            &lt;p class="ch_title"&gt;Inaltime:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;65&lt;/p&gt;
            &lt;p class="ch_title"&gt;Diametru (inch):&lt;/p&gt;
            &lt;p class="ch_spec"&gt;15&lt;/p&gt;
            &lt;div class="clear"&gt;&lt;/div&gt;
         &lt;/div&gt;
         &lt;div class="box-specificatie"&gt;
            &lt;div class="ch_group"&gt;Caracteristici tehnice&lt;/div&gt;
            &lt;p class="ch_title"&gt;Anotimp:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;Iarna&lt;/p&gt;
            &lt;p class="ch_title"&gt;Indice sarcina:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;91&lt;/p&gt;
            &lt;p class="ch_title"&gt;Indice viteza:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;T&lt;/p&gt;
            &lt;p class="ch_title"&gt;Economie de carburant:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;C&lt;/p&gt;
            &lt;p class="ch_title"&gt;Franare pe suprafete umede:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;C&lt;/p&gt;
            &lt;p class="ch_title"&gt;Tip vehicul:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;Turism&lt;/p&gt;
            &lt;p class="ch_title"&gt;DOT:&lt;/p&gt;
            &lt;p class="ch_spec"&gt;2014&lt;/p&gt;
            &lt;p class="ch_title"&gt;Nivel de zgomot (dB):&lt;/p&gt;
            &lt;p class="ch_spec"&gt;72dB&lt;/p&gt;
            &lt;div class="clear"&gt;&lt;/div&gt;
         &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>The problem is the function that returns an empty array.</p>