Skip to content

Instantly share code, notes, and snippets.

@orlissenberg
Created July 10, 2015 11:09
Show Gist options
  • Save orlissenberg/3094f69fba4b99e965b1 to your computer and use it in GitHub Desktop.
Save orlissenberg/3094f69fba4b99e965b1 to your computer and use it in GitHub Desktop.
SOAP / PHP 5.6.7 (Zend Server 8) stream context TLS - Failed to load external entity.
<?php
// http://php.net/manual/en/migration56.openssl.php
if (version_compare(phpversion(), '5.6', '>='))
{
$wsdl = 'https:// ...'
$opts = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT // !!
)
);
$parameters = [
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
'ssl_method' => SOAP_SSL_METHOD_TLS,
'stream_context' => stream_context_create($opts),
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'classmap' => []
'encoding' => 'UTF-8'
'trace' => 1,
'exceptions' => 1
];
$soapClient = new SoapClient($wsdl, $parameters);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment