Html to array

Hello,

What is the best way to extract two tables from html file. The html code is like

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Qtbl</title></head><body>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td style="vertical-align: top;">H1</td>
      <td style="vertical-align: top;">H2</td>
    </tr>
    <tr>
      <td style="vertical-align: top;">C1<br>
      </td>
      <td style="vertical-align: top;">C2<br>
      </td>
    </tr>
  </tbody>
</table>
<br>
<br>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td style="vertical-align: top;">H3<br>
      </td>
      <td style="vertical-align: top;">H4<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">C3<br>
      </td>
      <td style="vertical-align: top;">C4<br>
      </td>
    </tr>
  </tbody>
</table>
<br>
</body></html>

the preferred output is like

array(2) {
  [0]=>
  array(2) {
    [0]=>
    array(2) {
      [0]=>
      string(2) "H1"
      [1]=>
      string(2) "H2"
    }
    [1]=>
    array(2) {
      [0]=>
      string(2) "C1"
      [1]=>
      string(2) "C2"
    }
  }
  [1]=>
  array(2) {
    [0]=>
    array(2) {
      [0]=>
      string(2) "H3"
      [1]=>
      string(2) "H4"
    }
    [1]=>
    array(2) {
      [0]=>
      string(2) "C3"
      [1]=>
      string(2) "C4"
    }
  }
}

This might help, [google]extract table php dom[/google] which leads to this tutorial which extracts from a table, you will need the DOM extension to be working on your server though.