note 100559 added to function.stream-context-create
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 23 Oct 2010 05:45:58 +0000 |
| Subject: | note 100559 added to function.stream-context-create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173394@lists.php.net to get a copy of this message | ||
If you are trying to set a custom http header on php 5.2.x, try this:
// build header and set it the usual way
$authenticationHeader = $headername . ': ' . $headervalue;
$opts = array(
'http' => array(
'header' => $authenticationHeader
)
);
// workaround for php bug where http headers don't get sent in php 5.2
if(version_compare(PHP_VERSION, '5.3.0') == -1){
ini_set('user_agent', 'PHP-SOAP/' . PHP_VERSION . "\r\n" .
$authenticationHeader);
}
$context = stream_context_create($opts);
// now use context for soap call or whatever...
this is the only option that worked for me.
----
Server IP: 69.147.83.197
Probable Submitter: 216.243.7.205
----
Manual Page -- http://www.php.net/manual/en/function.stream-context-create.php
Edit -- https://master.php.net/note/edit/100559
Del: integrated -- https://master.php.net/note/delete/100559/integrated
Del: useless -- https://master.php.net/note/delete/100559/useless
Del: bad code -- https://master.php.net/note/delete/100559/bad+code
Del: spam -- https://master.php.net/note/delete/100559/spam
Del: non-english -- https://master.php.net/note/delete/100559/non-english
Del: in docs -- https://master.php.net/note/delete/100559/in+docs
Del: other reasons-- https://master.php.net/note/delete/100559
Reject -- https://master.php.net/note/reject/100559
Search -- https://master.php.net/manage/user-notes.php