In my application, I have the need to download a ZIP file from an http server. I simply send the http server the GET request (along with other requirements, ie host header, etc) and I continuously read from the buffer and through each iteration, I write the read data to a file (of extension ZIP) using the fwrite() function.
What happens is, that when I come to extract the file it says: "No archives found". But if I download the same ZIP from my browser, I can extract the files perfectly.
My question is, that if I am reading ALL of the data from a ZIP file and writing it to another ZIP file, why should it not work?
PS. I know you might think it is a problem with the connecting/reading/writing, but it is not, because when I request a file other than a file with the zip-compression, it works fine.