I have an API that returns results after being sent POST data.
Currently I am using fopen.
I am told that when sent the correct header, the API will return gzip compressed results.
How do I send the Accept Encoding header with fopen?
Currently, the relevant code looks like:
$params = array('http' => array(
'method' => 'POST',
'content' => $xml,
'header' => 'Content-type: application/x-www-form-urlencoded' . "\r\n",
'ignore_errors' => $ignoreErrors
));
$ctx = stream_context_create($params);
$fp = fopen($url, 'rb', false, $ctx);
All the examples / etc that are easily found in Google relate to people trying to read streams that are always gzip compressed or people looking to set the header so they can send compressed data.