> This won't be 100% accurate, but you could estimate the gzipped size[color=blue]
> using:
> strlen(gzcompress($file));[/color]
Thanks governor, an obvious solution, I was sitting on my brains...-) I
guess.
Then again, this would give a false result when the remote server was
sending uncompressed data.
[color=blue]
> Also, an "I'm not sure that does what you think it does" note. The Apache
> directive only applies when people are requesting web pages from your
> server. This is good, and can save you some bandwidth, but it doesn't have
> any effect on your PHP scripts when they download remote files. Your
> scripts are downloading the raw, uncompressed data.[/color]
IMO when the remote server is configured to sent compressed data,
that's what
a) my server
b) my PHP script
get. I guess that my server handles the decoding and
passes it to my script.
http://web-sniffer.net
detects correctly wether a server uses compression or not.
I checked it by requesting my domain with:
"php_value output_handler ob_gzhandler"
set and unset by htaccess.
So somehow it's possible...
I guess that opening a socket myself using PEAR:Net would be needed,
(bypassing file_get_contents and it ilk) but I can't figure out the
details.
Marek
bn548mm@g214mx.net
(remove numbers to despam)
"Senator Jay Billington Bulworth" <f@fung.arg> wrote in message
news:Xns95F3E4FB51ECDCANDLETRUCK@65.24.7.150...[color=blue]
> "Marek Möhling" <nospam@nospam.org> wrote in
> news:cu1fmh$rk8$05$1@news.t-online.com:
>[color=green]
>> My server (Apache/1.3.28 - PHP/4.3.3)
>> is configured to receive gzipped data via:
>> Header append Accept-Encoding "gzip, deflate"
>>
>> PHP is configured to send gzipped data via:
>> php_value output_handler ob_gzhandler
>>
>> When downloading files from servers that send gzipped data as well,
>> I'd like to get the filesize before and after my server decompresses
>> them.
>>
>> ============================================
>> // same result with fopen()
>> $file = file_get_contents("http://someUrl");
>> ============================================
>>
>> strlen($file) yields the decompressed filesize, however.
>> How can I measure the filesize of the compressed data?[/color]
>
> This won't be 100% accurate, but you could estimate the gzipped size
> using:
>
> strlen(gzcompress($file));
>
> Also, an "I'm not sure that does what you think it does" note. The Apache
> directive only applies when people are requesting web pages from your
> server. This is good, and can save you some bandwidth, but it doesn't have
> any effect on your PHP scripts when they download remote files. Your
> scripts are downloading the raw, uncompressed data.
>
> hth
>
>
> --
> Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg');
> --------------------------|---------------------------------
> <http://www.phplabs.com/> | PHP scripts, webmaster resources[/color]