Søren Beck Jensen
Søren Beck Jensen

Reputation: 1676

What native PHP methods can I reliably use to compress/uncompress data for sending via http?

I need to send a fairly large chunk of data from one server (PHP 5.3) to thousands of different servers running all sorts of different PHP versions, web servers, modules and operating systems (all PHP 4.3+).

The data I am sending is formatted text with lots of white space etc. So I would like to compress it before sending and uncompress it at the end point.

Is there a native PHP solution that will allow me to do this?

If not, what would be the solution supported by the most end points?

It does not necessarily have to compress the data, but prepare it for transport via HTTP. Does urlencode() preserve line breaks?

Upvotes: 0

Views: 100

Answers (1)

m4t1t0
m4t1t0

Reputation: 5721

You can use gzcompress and gzuncompress functions, this functions were available since PHP 4.0.1

Upvotes: 2

Related Questions