在将字符串发送到服务器之前压缩字符串

I want to minimize the size of my HTTP POST data sent from my android app to the server. The server runs on PHP. Can I utilize any compression method for that?

You can use the compress and decompress the request and response using GZIP. You need to set the Request Headers

Content-Encoding : gzip

You can use GZip to compress your request. Android also supports GZip request. In that canse Your webserver would then need to handle gzip compression.

There were some SO Questions regarding how to GZip your request. You can refer to this post too, which says you can implement as below.

private static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
private static final String ENCODING_GZIP = "gzip";
final DefaultHttpClient client = new DefaultHttpClient(manager, parameters);