0

I'm downloading once a day a large json output emitted wy a my webapi. My api server can output using gzip encoding, but it checks if to do this testing if HTTP_ACCEPT_ENCODING contains the word 'gzip'.

From webserver with the client script, I use file_get_content to read the json. But how to warn the api server that i'm able to accept gzip?

realtebo
  • 23,922
  • 37
  • 112
  • 189

1 Answers1

1

Apparently you can send headers (e.g. the HTTP_ACCEPT_ENCODING header) with your file_get_contents() request as described here.

An alternative could be using cURL to send the request with custom headers.

Community
  • 1
  • 1
minitauros
  • 1,920
  • 18
  • 20