[development] dealing with gzipped data with php.

Augustin (Beginner) drupal.beginner at wechange.org
Sat Sep 9 17:24:18 UTC 2006


On Sunday 10 September 2006 12:35 am, Augustin (Beginner) wrote:
> Hello,
>
> I have a question that is tough for me, but hopefully easy for you :)
>
> I am getting some data via XML RPC. One particular method is sending me a
> "gzipped array of 32 bits unsigned big endian integers". Sorry to be rude,
> but I had to say it!
>
> So, basically I have:
> $xml_rpc_reply['data'] = gzipped file;
>
> How can I unzip on the fly the data so I can deal with it?
> Does it need a particular setup, apache/php server side?
> Assuming I manage to unzip the data, how do I then deal with the '32 bits
> big endian integers' within it?


Well, I think I already have part of the answer.



There are two aspects to the problem: the compression, and the integers.

About the compression, I would need to enable this module:
http://php.net/manual/en/ref.zlib.php


About the gremlins ("32 bits unsigned big endian integers, one integer"), we 
may have more of a problem:
http://php.net/manual/en/language.types.integer.php
""The size of an integer is platform-dependent, although a maximum value of 
about two billion is the usual value (that's 32 bits signed). PHP does not 
support unsigned integers.""

Is the solution as easy as handling the signs properly?
If I have (trying to guess):
a = -3,
b = -1,
c = 0,
d = 1,
e = 3
Then the proper order is:
c = 0,
d = 1,
e = 3,
b =  y + 1,
a = y + 3
???


A.

-- 
http://www.wechange.org/
Because we and the world need to change.
 
http://www.reuniting.info/
Intimate Relationships, peace and harmony in the couple.


More information about the development mailing list