note 125454 deleted from soapclient.soapclient by crell
| From: | crell@php.net | Date: | Mon, 04 Apr 2022 16:51:43 +0000 |
| Subject: | note 125454 deleted from soapclient.soapclient by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218107@lists.php.net to get a copy of this message | ||
Note Submitter: Jim L
----
I was struggling to with a vendor's API that required a specific Content-Type in the HTTP
header. Looking over the PHP source code, I found an undocumented feature that allows for this.
<?php
// Add a custom header and override PHP's default Content-Type.
$stream_context = [
'http' => [
'header' => 'authType: 2WAYSSL',
'content_type' => 'text/xml;charset=utf-8',
]
];
$client = new SoapClient("some.wsdl", ['stream_context' =>
stream_context_create($stream_context)]);
?>