I have a report that is automatically emailed to me every morning, with the corresponding email account setup to save the incoming emails into a .txt file. This email report contains a zipped csv file that is attached.
What I would like to do is to create a php script that when initiated will open this .txt file, grab the attachment, unzip the attachment, read the contents, and add it into a database.
I know how to have script read a file, and then grab the text that I'm interested in, however, once I have this text, how would I go about unzipping it to read the resulting data.
By hand I've tried just taking the attached data, and pasting it into notepad and trying to save it as a .zip file, and then have tried to open it, but I get errors even when I try to do that. "The zipped file is invalid or corrupt".
Any help would be greatly appreciated. Thanks.