Reputation: 93
I'm sending a base64 string compressed with zlib in Python, converted to base64, sent to a PHP page where it will be extracted.
I'm having trouble with this. How would I do this?
Right now I have:
python
compressor = zlib.compressobj(wbits=(16+zlib.MAX_WBITS))
compressed = compressor.compress(str)
compressed += compressor.flush()
php
*POST deccoded here, b64data is the output*
$b64data = zlib_decode($data);
I left out the part where I decode from base64. The php code throws and error about invalid data at the zlib function.
zlib_decode(): data error
Upvotes: 2
Views: 990
Reputation: 93
Ok, I messed up and the problem wasn't with the zlib function.
Long story short I used to encode the data twice on the Python side but changed it to only encode once and never removed the extra base64_decode
from the PHP.
Thanks for the help guys.
Upvotes: 1