//Once parse move this file to here $parsedfile = "files/parsed/" . $fileToParse["id"] . ".xml"; echo "Procesing {$filename} \n"; if (file_exists($filename)) { $output = ""; $file = fopen($filename, "r"); if (FALSE === $file) { echo "cannot open {$filesToParse['id']}.xml , exiting..\n"; exit; } while (!feof($file)) { //read file line by line into variable $output = $output . fgets($file, 4096); } fclose($file); $data = $parser->parseFeed($output); //The table names $elements = $data[0]; //The parsed data $attrs = $data[1]; $element_nr = count($elements); $notifications = array(); for ($i = 0; $i < $element_nr; $i++) { $id = $attrs[$i]["id"]; if (!$id) { continue; } //Check if this row already exists in the table $n = loadObject($id, $elements[$i]); if ($n === false) { //New element, INSERT it into table