You'll need to do some parsing on your file to get what you want.
If your file will always have a string formatted like this "<table name=123" then this code should work:
// Get the starting position of the table
$start = strpos($fcontents, "<table name=123");
// Get the ending position of the table
$end = strpos($fcontents, "</table>", $start) + 8;
// Calculate the length of our section
$len = $end - $start;
// Pull our section
$table = substr($fcontents, $start, $len);
That should get you what you want as long as the html is well formed and the strings that you are looking for are correct.