0

I need gzip data in golang ,and post it to other API Service (wirte with php),but API Server can't ungzip ,why?

why golang and php gzip results are different ? thanks in advance

gzip string "1" :

  1. golang result :[31 139 8 0 0 9 110 136 2 255 50 4 0 0 0 255 255]

  2. php result :[31 139 8 0 0 0 0 0 2 3 51 4 0 183 239 220 131 1 0 0 0 ]

see demo

  1. golang code
  2. php code
ysqi
  • 86
  • 7
  • 1
    The marked question compares gzip results of **Java** and **Go** examples, but the reason is the same. Compression algorithms are not required to (and often they don't) generate the same result, even if the same app is run on the same input again. What matters is that when they are decompressed, it should give back the exact same result (the original input). – icza Jul 29 '15 at 16:01
  • Potentially the issue could be for different default values of the third parameter for gzcompress... try ZLIB_ENCODING_GZIP and ZLIB_ENCODING_RAW – Orangepill Jul 29 '15 at 16:02
  • thanks, i will check the app service , why cna't deccompressed – ysqi Jul 30 '15 at 00:23
  • I have ask new question : [php can't decompress gzip data by golang](http://stackoverflow.com/questions/31759354/php-cant-decompress-gzip-data-by-golang) – ysqi Aug 01 '15 at 08:02

0 Answers0