PHD AUTOMOBILES


Admin", $result, $matches); //print_r($matches); curl_close($curl); $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($result); libxml_clear_errors(); $xpath = new DOMXpath($dom); $data_test = array(); $data = array(); // get all table rows and rows which are not headers $table_rows_test = $xpath->query('//table/th'); foreach($table_rows_test as $row => $tr) { foreach($tr->childNodes as $td) { $data_test[$row][] = preg_replace('~[\r\n]+~', '', trim($td->nodeValue)); } $data_test[$row] = array_values(array_filter($data_test[$row])); } $table_rows = $xpath->query('//table/tr'); foreach($table_rows as $row => $tr) { foreach($tr->childNodes as $td) { $data[$row][] = preg_replace('~[\r\n]+~', '', trim($td->nodeValue)); } $data[$row] = array_values(array_filter($data[$row])); } echo ''; foreach($data_test as $row){ echo ''; } foreach($data as $row){ echo ''; foreach($row as $value){ echo ''; } echo ''; } echo '
'; foreach($row as $value){ echo $value; } echo '
'; echo $value; echo '
'; ?>