How do i import a CSV file that is zipped.
CSV file = xyz.txt
Zipped file = xyz_zip.zip
I have worked on the following code to get the whole xyt.txt date into a variable ($content).
<?php
$zip = zip_open("xyz_zip.zip");
if ($zip)
{
while ($zip_entry = zip_read($zip))
{
if (zip_entry_open($zip, $zip_entry))
{
$contents = zip_entry_read($zip_entry,zip_entry_filesize($zip_entry));
echo "$contents<br />";
zip_entry_close($zip_entry);
}
}
zip_close($zip);
}
?>
The problem is that fopen() need a CSV file but i have is a variable with the content of the CSV file.
How do i import $content data into mysql database ?
Please help.