hessodreamy — 2011-10-11T10:49:44-04:00 — #1
I've got a script which fetches zipped content from a web page. Under normal circumstances the browser would donwload this as a zip file, but for my script the remote server just returns the compressed string, and I'm trying to figure out how to uncompress it. Apparently it's compressed using PKzip if that's any help.
I've tried just writing it to a file
$fh = fopen("zipfile.zip","w");
But when I try to open the zip file (after writing it) it appears to be invalid.
I've tried gzuncompress() and gzinflate(), eg
but it still outputs gibberish.
gvre — 2011-10-11T17:27:34-04:00 — #2
hessodreamy — 2011-10-12T04:43:24-04:00 — #3
I've looked through the functions there, but they all seem to deal with a zipped file, rather than the actual zipped contents. What I've got is the zipped output from a remote server.
gvre — 2011-10-13T14:58:09-04:00 — #4
Could you post the url of the zip file and your script's code?
hessodreamy — 2012-05-22T05:23:37-04:00 — #5
Have re-visited this problem and got it sussed.
I think the main problem I had was that I was grabbing a stream straight from a website, and part of this stream was the headers. I needed to remove the headers and then the content of the response was a valid zip file.
I unzipped it using the pclzip class. I'm not sure whether the gzinflate would have been correct or incorrect for zipped content, but I think the headers were the main problem.