title: SoapFault exception [HTTP] Could not connect to host: With Local SSL Certificate
body: <p>I am trying to connect to a SOAP webservice with a local SSL file using PHP Soap client.
  As a local SSL certificate will not work correctly with PHP I already downloaded WSDL file and saved this locally.</p>
  
  <p>Now As I am trying to connect to the webservices I get this error:</p>
  
  <pre><code>SoapFault exception: [HTTP] Could not connect to host in /var/www/index.php:38 Stack trace: #0 [internal function]: SoapClient-&gt;__doRequest('__call('GetTests', Array) #2 /var/www/index.php(38): SoapClient-&gt;GetTests() #3 {main}
  </code></pre>
  
  <p>I am working on a Debian Wheezy server.
  As I did some reading on Stackoverflow I found that you should enable openssl which I did install and is loaded according to the phpinfo();</p>
  
  <p>When running the script I do:</p>
  
  <pre><code>soap.wsdl_cache_enabled = 0
  soap.wsdl_cache_ttl = 0
  </code></pre>
  
  <p>In my /etc/hosts file I added the service just to be sure</p>
  
  <p>I set my firewall to accept SOAP:</p>
  
  <pre><code>ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1664
  ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1664
  </code></pre>
  
  <p>And I tried several settings in the PHP file like using TLS or SSLv3 etc.
  None of the above helped.</p>
  
  <p>Here is my script:</p>
  
  <pre><code>error_reporting(E_ALL ^ E_NOTICE);
  ini_set('soap.wsdl_cache_enabled',0);
  ini_set('soap.wsdl_cache_ttl',0);
  
  $wsdl = "/var/www/php/soap.wsdl";
  $url =  "https://www.soaptest.nl/api/soap";
  $pem = "/var/www/php/my_interface.p12";
  
  $client = new SoapClient(
      $wsdl,
      array(
          "location" =&gt; "https://www.soaptest.nl/api/soap",
          //"uri" =&gt; "http://www.soaptest.nl/api",
          "local_cert" =&gt; $pem,
          "passphrase" =&gt; "mypassforthepem",
          "soap_version" =&gt; SOAP_1_1,
          "trace" =&gt; true,
          "exceptions" =&gt; 0,
          "features" =&gt; SOAP_SINGLE_ELEMENT_ARRAYS
      )
  );
  
  print $client-&gt;GetTests();
  </code></pre>
  
  <p>So with all settings I did so far, nothing seems to work. 
  I might forget something or do something which I should not, but I can't see it anymore.</p>
  
  <p>Please help me out and let me know more.
  Thanks in advance.</p>