PHP: how to use HTTP_ACCEPT_ENCODING to pass gzip acceptance when using fileget_contents()?

realtebo

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?

minitauros

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to decode "Content-Encoding: gzip, gzip" using curl?

How to use gzip encoding with wsgi application?

Accept gzip encoding using httr R

How to pass a http header using a variable in curl using PHP

How to use DecompressionStream to decompress a gzip file using JavaScript in Browser?

gzip_http_version 1.1; in Nginx, when using HTTP/2

Acceptance Tests for Tetris when using Test Driven Development

How to use sinon.useFakeTimers with ember-testing (acceptance)?

(Go) How to control gzip compression when sending http request?

How to use gzip correctly in a makefile?

How to get feedback from saga handler using NServiceBus Acceptance Testing

How to assert value set by jQuery in Acceptance Test using Codeception?

How do I pass cookies when making a REST API call using PHP

How to correctly define Accept-Encoding: gzip header in RAML?

How to pass arrays when using Ellipsis in Java?

How to not pass the value by function when using mongoose

How to pass properties to Java when using COMPSs

How to pass a password when using HtmlAgilityPack

How to pass argument when using .agg() method?

How to properly pass headers when using SWR?

How to pass variable in PHP using include?

How to pass id parameter using php laravel?

How to pass parameters to php using get JSON

How to pass parameters in url using php page

How to pass slashes in Elasticsearch query using PHP?

How to pass and access the array variable using php

how to pass data to php using ajax?

how to pass data to php by using ajax .post()

How correctly pass data to php using ajax?