The Note You're Voting On
php at rapsys dot eu ¶
4 years ago
Here is a snippet to read compressed raw post data without enabling global variables.
I needed it to read xml posted data submitted by ocs agent. The data was sent as Content-Type: application/x-compressed (zlib compressed data).
It seems related to an old bug which still seems broken :
The important part is the default window set to 15 instead of -15.
$data = '';
$fh = fopen('php://input', 'rb');
stream_filter_append($fh, 'zlib.inflate', STREAM_FILTER_READ, array('window'=>15));
$data .= fread($fh, 8192);