Correctly adding Auth Bearer Tokens to PHP SoapClient

July 19, 2019 Off By carlos
$soapOptions = array(
'trace' => true,
'stream_context' => stream_context_create(
array(
'http' => array(
'header'=>"Authorization: Bearer GqZhgJK0KBPCcP3b65cwBoXtXcyh"
//'user_agent' => 'PHPSoapClient',
//'Authorization' => 'Bearer '
),
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,)
)
),

'cache_wsdl' => WSDL_CACHE_NONE,
'exceptions' => false,
'local_cert' => "C:\\inetpub\\wwwroot\\verizonv2tv\\certs\\verizon.pem",
//'local_cert' => "C:\\certificate\\vz certs test\\verizon.pem",
//'local_cert' => "C:\\inetpub\\wwwroot\\verizonv2tv\\certs\\verizon.p12",
'passphrase' => "password",


'connection_timeout' => 200,
);


$header = new SoapHeader(
"http://verizon.com/CoFEEAnywhere/CoAServices/v1","Authorization", "Bearer " . "quF23zWjiXXs0PgAd9ACxnhbW40z");