Greg wrote: > I am using zlib to deflate some data using: > > ret = ZLibdeflateinit2(ZLib, &strm, 6, Z_DEFLATED, 13, 6, Z_DEFAULT_STRATEGY, > ZLIB_VERSION, sizeof(z_stream)); > > I then pass the resulting string as multi-part form data to PHP code. > > This data seems to pass nicely to PHP variables but when I try and convert > the data back to it's original form I get a PHP error. > > I was hoping that I could then just use the PHP function gzinflate to inflate > the data back to its original form but the data from SysZLib does not seem to > be compatible with the PHP version of zlib. > > I looked at the same data that is deflated/compressed using zlib on the Palm > and server side and they are the same except for small variations at the > front 3 bytes and the last byte. > > Does anyone know if I can use PHP for decompression? > > Thanks > > Greg >
you can, zlib is the same. only problem is that you create raw zlib compressed stream and on php side you use function which expects gzip file format. all you have to do is to embed this stream you got from zlob to correct gzip file format. you may find format description here: http://www.faqs.org/rfcs/rfc1952.html or try to google for simpler description. fileformat itself is simple but in rfc is described in very foolproof but because of that also in very difficult way. basically fileformat is this: typedef struct GzipFile { UInt16 magic; //0x1f8b UInt8 method; UInt8 flags; UInt32 modification_time; UInt8 extra_flags; UInt8 source_os; // if(flags&4) // UInt16 extrafield_length; // char extrafield[extrafield_length]; // if(flags&8) // UInt16 filename_length; // char filename[filename_length]; // if(flags&16) // UInt16 comment_length; // char comment[comment]; // if(flags&??) // UInt16 crc16; // !!!following zlib compressed data: // .... // UInt32 crc // UInt32 size_uncompressed } GzipFile; details in link to rfc i wrote few lines ago -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
