java
string body = lorem ipsum shizzle ma nizle; url url = new url(http://some.url/file.php?id= + uid); urlconnection conn = url.openconnection(); conn.setdooutput(true); conn.setrequestproperty(content-encoding, deflate); conn.setrequestproperty(content-type, application/octet-stream); deflateroutputstream dos = new deflateroutputstream(conn.getoutputstream()); dos.write(body.getbytes()); dos.flush(); dos.close();
php
$content = http_get_request_body();$uncontent = gzuncompress($content);
二、ios与php的交互
php接收gzip压缩
gzdecode(base64_decode($json));//ios gzip uncompress
php接收zlib压缩
gzuncompress(base64_decode($json));//ios zlib uncompress
