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
  • 445,704
  • 82
  • 492
  • 529
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
  • 6,602
  • 10
  • 34
  • 47
-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
  • 8,104
  • 2
  • 28
  • 21
-3

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

devXen
  • 3,013
  • 3
  • 35
  • 44