Saturday, November 21, 2009

What should be replaced in the string ??????? below to open the archive myarchive.gz located in the document root of the www.example.com server and decompress it?

$file = '???????';

$fr = fopen($file, 'rb');

$data = "";
while(!feof($fr)) {
 $data .= fgets($fr, 1024);
}

fclose($fr);

Options:

a) compress.zlib://{$http}www.example.com/myarchive.gz
b) compress.zlib://http://www.example.com/myarchive.gz
c) compress.http://www.example.com/myarchive.gz
d) compress.http.zlib://www.example.com/myarchive.gz
e) compress.zlib://myarchive.gz

Reference :

Compression Streams
Zlib Functions

Comments to answer

2 comments:

  1. option (e) compress.zlib://myarchive.gz

    ReplyDelete
  2. compress.zlib://http://www.example.com/myarchive.gz

    source: in comments
    http://php.net/manual/en/wrappers.compression.php

    ReplyDelete