'uncompressing xml feed gzip deflate php

I am being sent an XML feed which needs to be downloaded in a 'compressed way'.

The example I have been given is this:

$url = 'http://myurl.com';
$headers[] = "Accept-Encoding: gzip,deflate";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$data = curl_exec($ch);

but the output I am getting is jargon like this:

��+T����s�ƒ-�}#���;}�w7f���d]K�F��x���HB$�&����G�����6������IW���Y��'�����߷��sR,�<������ �.��4���֫�'��������?''^�?9��;��*�9^|����>'�j�~���ǫ�}z��|���h���q���J����Գ"�.o������2)~���bU���~������I|

How to a convert it back into XML?

Many thanks



Solution 1:[1]

You can use gzinflate() to inflate a deflated string
gzdeflate() works in reverse.

Source: https://www.php.net/manual/en/function.gzdeflate.php

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ekimas