note 104122 modified in wrappers by danbrown
| From: | danbrown@php.net | Date: | Wed, 25 May 2011 13:05:12 +0000 |
| Subject: | note 104122 modified in wrappers by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180021@lists.php.net to get a copy of this message | ||
When daisy-chaining wrappers, I've found that the stream context only applies to the outside
wrapper. For example, the following code will not work:
<?php
$options = array('http'=>array('header'=>"Accept-Encoding:
gzip\r\n"));
$context = stream_context_create($options);
$html = file_get_contents('compress.zlib://http://example.com/resource.gz', 0, $context);
?>
The context in this case is useless for the compress.zlib:// wrapper but it does not get applied to
http:// and the header will not be sent.
--was--
When daisy-chaining wrappers, I've found that the stream context only applies to the outside
wrapper. For example, the following code will not work:
<?php
$options = array('http'=>array('header'=>"Accept-Encoding:
gzip\r\n"));
$context = stream_context_create($options);
$html = file_get_contents('compress.zlib://http://website.com/resource.gz', 0, $context);
?>
The context in this case is useless for the compress.zlib:// wrapper but it does not get applied to
http:// and the header will not be sent.
http://php.net/manual/en/wrappers.php