tags:

views:

291

answers:

6

To save network traffic I'd like to compress my data. The only trick is that I the client is a c application and the server is php. I'm looking for an open source compression library that's available for both c and php.

I guess I could write an external c application to decompress my data, but I'm trying to avoid spawning extra processes on the server.

If you know of any, please post it!

+1  A: 

ZLIB

Here's the page on accessing zlib from PHP.

Adam Pierce
A: 

You can probably instruct your web server to compress the data for you at the HTTP level, and then you won't have to worry about it on either end. For Apache, have a look at mod_deflate.

Greg Hewgill
+2  A: 

Zlib provides C APIs, and is part of the PHP functional API as well.

DGentry
+3  A: 

gzip is one of the most (if not the most) popular compression scheme. PHP has supported it since version 4. If you need even better compression, consider bzip2.

Jonah Braun
+2  A: 

Php supports zlib compression and for the c compression you could use zlib, but you should think again if you want to compress network communication - the load will probably be too much for your servers.

Svet
A: 

it depends on what data you are transferring. If it is text, use mod_gzip on apache (I am assuming you are using it). I have seen around 70% text compression with this. But if you are dealing with binary data, like images and videos, use media formats which are more compressible.

mixdev