Im using script to go through content of zipped files and the script just misses some of them
We have multiple ZIP archives on a server where invoices (Flat files) are stored. Im using following code to search though them:
foreach($zip_files as $zip_file){
echo $zip_file . "[" . $counter . "/" . $count . "]
";
$counter++;
//Opening and reading zip file
$zip_content = zip_open($archive_path . "\\" . $zip_file);
while($file = zip_read($zip_content)){
$filename = zip_entry_name($file);
if(strpos($filename,".rcv")){
$content = zip_entry_read($file,4086);
if(strpos($content, "<MvxEnvelope>")){
if(strpos($content, "<Field>TETINR</Field>")){
$type = "TETINR";
$TINR_position = strpos($content, "<Field>TETINR");
$DIVI_position = strpos($content, "<Field>DIVI");
$TINR = substr($content,($TINR_position + 28), 10);
$DIVI = substr($content,($DIVI_position + 26), 3);
fwrite($map, $zip_file . ";" . $filename . ";" . $DIVI . ";" . $TINR . ";" . $type . "
");
}
}
}
}
}
I would like the script to go through all files and not to miss some of them. Many thanks in advance