I'm trying to inflate Flash compressed buffer in PHP.
Here is what I have in Flex ActionScript:
var comp:ByteArray = new ByteArray();
comp.writeObject(buffer);
comp.compress(CompressionAlgorithm.DEFLATE);
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
request.contentType = contentType;
request.data = comp;
loader.load(request);
The contents of comp
will be uploaded to the server in the form of post data. A php script will inflate it:
$contents = gzinflate(file_get_contents($file));
The problem is that this way, the contents of $contents
is not identical to buffer
. It did inflate, but it always add 4 additional bytes. For instance, 32000 bytes became 32004 bytes. I'm not sure if it's the beginning or the end.
Is there any documentation on what this 4 bytes is about, and how should I inflate this data in php? Thank you.