The only way i can think with that specific file structure is by using file(), assuming the keys starts from keyX
$rows = file($file,FILE_IGNORE_NEW_LINES);
$found = FALSE;
$lines = array();
foreach($rows as $key => $row) {
if ($found && substr($row,0,3)=="key") {
break;
}
if ($found) {
$lines[] = $row;
}
if ($row === "keyerror") {
$found = TRUE;
}
}
print_r($lines);