3

Hi is there any possibility to download a zip file with curl and unzip it on the fly without to save the file ot the disc?

For example:

.
.
.

$resultZip = curl_exec($curl);

$result = some_unzip_way($resultZip);

Thanks! Nik

codaddict
  • 429,241
  • 80
  • 483
  • 523
Nik
  • 325
  • 1
  • 5
  • 15

3 Answers3

0

php curl has a flag to unzip content if needed

curl_setopt($ch,CURLOPT_ENCODING, '')

see this answer

Dotan
  • 5,264
  • 7
  • 30
  • 43
-3

Its not super easy, php has zip functions, but require a file to exist. Look at the first comment on this page, the guy describes your exact scenario and gives some code:

http://php.net/manual/en/ref.zip.php

profitphp
  • 7,852
  • 2
  • 25
  • 21
-3

Perhaps Perl is a better choice for that kind of operation.

devXen
  • 2,855
  • 3
  • 31
  • 43