How to unzip a compressed string in GZIP standard in PHP?

1

I need to uncompress a string compressed in the GZIP standard in PHP. The field type is base64Binary.

I've tried: gzinflate($string); gzdecode($string); gzuncompress($string);

But I only had return of "data error" in using the three functions. How could I solve this problem?

    
asked by anonymous 19.06.2017 / 18:51

1 answer

2

If the field is base64Binary (probably a webservice, maybe SOAP) then you have to use base64_decode and then gzdecode , something like:

$string = base64_decode($string);
$string = gzdecode($string);

var_dump($string); //Para testar o resultado
    
19.06.2017 / 18:55