note 125454 added to soapclient.soapclient

From: Date: Thu, 22 Oct 2020 18:24:52 +0000
Subject: note 125454 added to soapclient.soapclient
Groups: php.notes 
Request: Send a blank email to php-notes+get-215631@lists.php.net to get a copy of this message
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)]); ?> ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.174 (proxied: 207.166.192.127) ---- Manual Page -- http://php.net/manual/en/soapclient.soapclient.php Edit -- https://master.php.net/note/edit/125454 Del: integrated -- https://master.php.net/note/delete/125454/integrated Del: useless -- https://master.php.net/note/delete/125454/useless Del: bad code -- https://master.php.net/note/delete/125454/bad+code Del: spam -- https://master.php.net/note/delete/125454/spam Del: non-english -- https://master.php.net/note/delete/125454/non-english Del: in docs -- https://master.php.net/note/delete/125454/in+docs Del: other reasons-- https://master.php.net/note/delete/125454 Reject -- https://master.php.net/note/reject/125454 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#215631) next »