Why the data from the site when access via the PHP http stream - not sent in gzip? <p>There is an internal company website .. (accessible only via local network)</p> <p>I need... when accessing this site at _http: // company_syte / some_path / some_file inside of PHP code - data (HTML, which is on this page) transmitted in a compressed format (gzip, deflate, compress ...). Now the data is transmitted without compression ..</p> <p>Although, when I look at this site in any browser (ANY!) - the page is sent by the server in a compressed format (gzip). And when referring to this site via PHP code - I get in the response header - no compression .. I do not understand why??! .. help achieve data compression for handling by PHP.</p> <p>Any other sites (both: local and from internet .. when accessed from within a PHP code context options that are shown below - give their data in a compressed form, if the site can generate compression of the code ..)</p> <p>headers in PHP prepared by stream_get_meta_data (); or get_headers ()</p> <p>That option is the context that I use when opening streams ..</p> <pre><code>define ('STREAM_USER_AGENT', 'Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0'); // Default context options for streams $def_context_opts = array( 'http'=&gt;array( 'method'=&gt;'GET', //'proxy'=&gt;'internal-proxy.com:80', 'user_agent' =&gt;STREAM_USER_AGENT, 'header'=&gt; //'Content-type: text/html; charset=utf-8'. //'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' . 'Accept-Encoding: compress;q=1.0, gzip;q=1.0, deflate;q=0.8, sdch;q=0.5, identity;q=0.5, *;q=0.3' . 'Accept-language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3' . 'Cookie: FastPopSessionRequestNumber=8; platform=pc' . 'Cache-Control: max-age=0 '. //'Connection: keep-alive' . 'DNT: 1' . 'Referer: http://en.wikipedia.org/', 'timeout'=&gt;85, //'request_fulluri' =&gt;true //'max_redirects'=&gt;10 ) ); //Setting up default stream context stream_context_set_default($def_context_opts); </code></pre> <p>That response header, when accessing from within a PHP code using context options that gave above</p> <pre><code>Array ( [0] =&gt; HTTP/1.1 200 OK [1] =&gt; Server: nginx [2] =&gt; Date: Tue, 05 Jan 2016 16:14:59 GMT [3] =&gt; Content-Type: text/html; charset=UTF-8 [4] =&gt; Connection: close [5] =&gt; Set-Cookie: platform=pc; expires=Tue, 10-Jan-2062 08:29:58 GMT; Max-Age=1452096899; path=/ [6] =&gt; Set-Cookie: userSession=msij61yvt3j5ryp8ky8njdlwqfxwubjc; expires=Thu, 07-Jan-2072 08:29:58 GMT; Max-Age=1767370499; path=/ [7] =&gt; Vary: User-Agent [8] =&gt; Rating: RTA-5042-1996-1400-1577-RTA [9] =&gt; Set-Cookie: RNLBSERVERID=ded1714; path=/ ) </code></pre> <p>This response header of this website, when i opened it in my browser (Firefox)</p> <pre><code>HTTP/1.1 200 OK Server: nginx Date: Tue, 05 Jan 2016 13:32:07 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Vary: User-Agent Rating: RTA-5042-1996-1400-1577-RTA Content-Encoding: gzip </code></pre> <p>This request header of browser (firefox)</p> <pre><code>GET /document_law/3060771 HTTP/1.1 Host: somehost.com User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate DNT: 1 Cookie: FastPopSessionRequestNumber=8; platform=pc; _ga=GA1.2.302926937.1425596941; __atuvc=0%7C50%2C4%7C51%2C30%7C52%2C8%7C0%2C2%7C1; local_storage=1; gateway=56469083; gateway_security_key=6dbfca5fe39f71d3c1ab7683b2d0bbc6; expiredEnterModalShown=1; expiredEnterModalShown_security_key=0bddb66fa85f5b04e1965b8789b44432; userSession=1bbjnu3g8k56nhaav1ansdrralaxponn; RNLBSERVERID=ded1683; performance_timing=other; FastPopSessionRequestNumber=3; playlist_reset_playlist=1; _gat=1 Connection: keep-alive Cache-Control: max-age=0 </code></pre> <p>And this is a typical response when accessing via PHP on any other site (both local and internet ..) using the context options that gave upper ..</p> <pre><code>Array ( [0] =&gt; HTTP/1.1 200 OK [1] =&gt; Server: nginx [2] =&gt; Date: Tue, 05 Jan 2016 16:22:56 GMT [3] =&gt; Content-Type: text/html; charset=UTF-8 [4] =&gt; Content-Length: 30523 [5] =&gt; Connection: close [6] =&gt; X-Powered-By: PHP/5.5.30 [7] =&gt; Expires: Thu, 19 Nov 1981 08:52:00 GMT [8] =&gt; Cache-control: private, max-age=0 [9] =&gt; Set-Cookie: xf_session=d71d38dc39f78c932be8763951b9c247; path=/; httponly [10] =&gt; X-Frame-Options: SAMEORIGIN [11] =&gt; Last-Modified: Tue, 05 Jan 2016 16:22:56 GMT [12] =&gt; Content-Encoding: gzip [13] =&gt; Vary: Accept-Encoding ) </code></pre>