note 99353 modified in function.stream-context-create by danbrown

From: Date: Thu, 12 Aug 2010 14:29:45 +0000
Subject: note 99353 modified in function.stream-context-create by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171609@lists.php.net to get a copy of this message
I big NOTE that i hope will help some one. Something that is not mentioned in the documentation, is that when php is compiled --with-curlwrappers, So, instead of: <?php $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ) ); $context = stream_context_create($opts); ?> You would setup the header this way: <?php $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>array("Accept-language: en", "Cookie: foo=bar", "Custom-Header: value") ) ); $context = stream_context_create($opts); ?> This will work. --was-- I big NOTE that i hope will help some one. Something that is not mentioned in the documentation, is that when php is compiled --with-curlwrappers, So, instead of: ---------------------------------------------------------------- $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ) ); $context = stream_context_create($opts); ---------------------------------------------------------------- You would setup the header this way: ---------------------------------------------------------------- $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>array("Accept-language: en", "Cookie: foo=bar", "Custom-Header: value") ) ); $context = stream_context_create($opts); ---------------------------------------------------------------- This will work. http://php.net/manual/en/function.stream-context-create.php

« previous php.notes (#171609) next »