I see that you capture the html, you save it in a local file, you iterate it and I suppose that there comes the table with the tr and td.
A simple way to do what you want is:
You extract the code from the table:
$htmlTable = "";
$switch = 0;
$tipo = 0;
while (($line_detail = fgets($file)) !== false) {
$pos = strpos($line_detail, '<table');
if ($pos !== FALSE) {
/* Bien o Lote */
$switch = 1;
}
if ($switch == 1) {
$htmlTable .= $line_detail;
}
$pos = strpos($line_detail, '/table');
if ($pos !== FALSE) {
$switch = 0;
}
}
$htmlTable = "<html>" . $htmlTable . "</html>";
Then, you iterate the rows TR and TD
$dom = new DOMDocument();
@$dom->loadHTML($htmlTable);
$rows = $dom->getElementsByTagName("tr");
$dataCols = "";
$identificador = "";
for ($i = 0; $i < $rows->length; $i++) {
/* Solo los indices a procesar para el detalle de la subasta */
/*if (!in_array($i, $detailRows)) {
continue;
}*/
$cols = $rows->item($i)->getElementsbyTagName("td");
for ($j=0; $j<$cols->length; $j++) {
/* Aqui trabajas la logica segun lo que necesites ... */
}
Finally you work the logic you need.
Completely solving what you need with the information you give is complicated. I hope this is your guide.
Greetings,