Created
November 28, 2017 13:55
-
-
Save loru88/7b67e23ff6df77b2bc56f550d164a198 to your computer and use it in GitHub Desktop.
SOAP in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* http://php.net/manual/en/soapclient.soapclient.php | |
* | |
**/ | |
$options = array(); | |
// general option | |
$options['encoding'] = 'UTF-8'; | |
$options['soap_version'] = SOAP_1_1; | |
$options['cache_wsdl'] = WSDL_CACHE_NONE; | |
$options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP; | |
// for debugging | |
$options['trace'] = true; | |
$options['exceptions'] = true; | |
// basic authentication | |
$options['login'] = '{{ domain\username }}'; | |
$options['password'] = '{{ password }}'; | |
// SSL certificate configuration, http://php.net/manual/en/context.ssl.php | |
$options['stream_context'] = stream_context_create([ | |
'ssl' => [ | |
'verify_peer'=> true, | |
'verify_peer_name' => false, | |
'allow_self_signed' => true, | |
'local_cert' => '{{ public key pem path }}', | |
'local_pk' => '{{ private key pem path }}', | |
'passphrase' => '{{ cert password }}' | |
] | |
]); | |
//create the client | |
$client = new SoapClient('{{ path to WSDL }}', $options); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment