I want to read a the .txt file content from a .zip file that contains many other .txt files. But hope do not need to download the .zip file to the local machine..
How can I use functions like zip_open
/zip_read
to do it?
$path = 'Data/2021';
ftp_login($conn,$user,$pass);
ftp_chdir($conn,$path);
ftp_pasv($conn,TRUE);
foreach (ftp_nlist($conn,".") as $Lot_Zip) {
$Lot_Zip = Trim($Lot_Zip);
$Lot_Zip_Name = substr($Lot_Zip,0,10);
if (preg_match("/$Lot_Zip_Name/i",$ParsedLot_String)){
echo "processing ", $Lot_Zip, " ...\n";
// $Lot_Zip = $path.'/'.$Lot_Zip also can't be zip_open
$zip = zip_open($Lot_Zip);
echo "ZIP: ", $zip ,"\n"; //return value is 11
if ($zip)
{
while ($zip_entry = zip_read($zip))
{
echo "Name: " . zip_entry_name($zip_entry) . "\n";
}
}
}
}