title: Parse HTML table into array with PHP- get image attributes
body: <p>I'm trying to parse a table from an HTML webpage, but I'm having trouble.</p>
  
  <p>Here is what my HTML approximately looks like :</p>
  
  <pre><code>&lt;tbody&gt;
  
  &lt;tr class="even"&gt;
  &lt;td class="time"&gt;Monday 20:10&lt;/td&gt;
  &lt;td class="place"&gt;Paris 14&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr class="odd"&gt;
  &lt;td class="time"&gt;Monday 21:00&lt;/td&gt;
  &lt;td class="place"&gt;Paris 13&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;/tbody&gt;
  </code></pre>
  
  <p>EDIT : Here is my PHP</p>
  
  <pre><code>&lt;?php
  
  $url = 'https://www.gymsuedoise.com/loc/dt/?id=64';
  
  
  $options = array(
      CURLOPT_RETURNTRANSFER =&gt; true,     // return web page
      CURLOPT_HEADER         =&gt; false,    // don't return headers
      CURLOPT_FOLLOWLOCATION =&gt; true,     // follow redirects
      CURLOPT_ENCODING       =&gt; "",       // handle all encodings
      CURLOPT_USERAGENT      =&gt; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0", // something like Firefox 
      CURLOPT_AUTOREFERER    =&gt; true,     // set referer on redirect
      CURLOPT_CONNECTTIMEOUT =&gt; 120,      // timeout on connect
      CURLOPT_TIMEOUT        =&gt; 120,      // timeout on response
      CURLOPT_MAXREDIRS      =&gt; 10,       // stop after 10 redirects
  );
  
  $curl = curl_init($url); curl_setopt_array( $curl, $options ); $content = curl_exec($curl); curl_close($curl);
  $dom = new DOMDocument(); @$dom-&gt;loadHTML($content); $xpath = new DOMXPath($dom); 
  
  $tables = $dom-&gt;getElementsByTagName('tbody'); 
  $rows = $tables-&gt;item(0)-&gt;getElementsByTagName('tr');
  
  foreach ($rows as $row) 
  { 
  
  $cols = $row-&gt;getElementsByTagName('td'); 
  
  $date = $cols-&gt;item(0)-&gt;nodeValue; $liste_element[$i]['date'] = trim($date);
  $intensite = $cols-&gt;item(2)-&gt;nodeValue; $liste_element[$i]['intensite'] = trim($intensite);
  $animateur = $cols-&gt;item(3)-&gt;nodeValue; $liste_element[$i]['animateur'] = trim($animateur);
  $forfait = $cols-&gt;item(5)-&gt;nodeValue; $liste_element[$i]['forfait'] = trim($forfait);
  
  $i++;
  } 
  
  echo '&lt;pre&gt;';            
  print_r ($liste_element);
  echo '&lt;pre&gt;';            
  
  ?&gt;
  </code></pre>
  
  <p>My issue is that my script can't scrape anything in the 6th column (i.e. <code>item(5)</code>) of the table, as there are only pictures and no text. 
  How could I scrape the content in the <code>alt</code> or <code>title</code> attribute if the the <code>&lt;img&gt;</code> tag ?</p>