PROLOG") AND !strstr($xml, "")) { $compressmode = "gzcompress"; } } else if ($xml = @gzinflate (substr($http_raw_post_data, 2))) { // ** OCS agent 2.0 Compatibility, but return in gzcompress $compressmode = "gzdeflate"; if (strstr($xml, "PROLOG") AND !strstr($xml, "")) { $compressmode = "gzcompress"; } } else { $f = tempnam('/tmp', 'gz_fix'); file_put_contents($f, "\x1f\x8b\x08\x00\x00\x00\x00\x00".$http_raw_post_data); $xml = file_get_contents('compress.zlib://'.$f); unlink($f); if (strpos($xml, "PROLOG<\/QUERY/', $xml)) { $reply= ' SEND 8 '; } else { $reply = " "; $invFile = sprintf('%s/%s.xml', $dumpDir, $_SERVER['REMOTE_ADDR']); if (!file_put_contents($invFile, $xml)) { error_log("Failed to write "); } } switch($compressmode) { case 'none': print $reply; break; case 'gzcompress': print gzcompress($reply); break; case 'gzencode': print gzencode($reply); break; case 'gzdeflate': print gzdeflate($reply); break; }