diff --git a/lib/Transip/Api/SoapClientAbstract.php b/lib/Transip/Api/SoapClientAbstract.php index 8dee9a0..c51b2d9 100644 --- a/lib/Transip/Api/SoapClientAbstract.php +++ b/lib/Transip/Api/SoapClientAbstract.php @@ -62,6 +62,18 @@ protected function soapClient(array $classMap, $parameters = array()) 'trace' => false, // can be used for debugging ); + $options = array_merge($options, $this->client->getSoapOptions()); + + $streamOptions = array( + 'ssl' => array( + 'SNI_enabled' => true, + 'SNI_server_name' => $endpoint, + 'peer_name' => $endpoint, + ) + ); + $streamContext = stream_context_create($streamOptions); + $options['stream_context'] = $streamContext; + $wsdlUri = "https://{$endpoint}/wsdl/?service=" . $this->service; try { $this->soapClient = new \SoapClient($wsdlUri, $options); diff --git a/lib/Transip/Client.php b/lib/Transip/Client.php index f270373..c64eeab 100644 --- a/lib/Transip/Client.php +++ b/lib/Transip/Client.php @@ -49,6 +49,11 @@ class Client */ protected $privateKey; + /** + * Option to add aditional options to the SoapClient(http://php.net/manual/en/soapclient.soapclient.php) + */ + protected $soapOptions = array(); + /** * @param string $login * @param string $privateKey @@ -151,4 +156,20 @@ public function setMode($mode) throw new \Exception("$mode is not a available mode for this API."); } + + /** + * @return array + */ + public function getSoapOptions() + { + return $this->soapOptions; + } + + /** + * @param array $soapOptions + */ + public function setSoapOptions($soapOptions) + { + $this->soapOptions = $soapOptions; + } }