title: Unable to connect to test.salesforce.com with SSL
body: <p>I'm having some problems connecting to a SOAP Service at <a href="https://test.salesforce.com" rel="nofollow">https://test.salesforce.com</a>. I use the Toolkit-for-PHP v20.0 (https://github.com/developerforce/Force.com-Toolkit-for-PHP) which is based on PHP's native SoapClient.</p>
  
  <p>Software:</p>
  
  <ul>
  <li>MacOS 10.8</li>
  <li>Macports 2.1.2</li>
  <li>PHP 5.3.15</li>
  <li>OpenSSL 1.0.1_c</li>
  </ul>
  
  <p>The only error message I receive after 30 seconds (timeout?) is:</p>
  
  <pre><code>[SoapFault]                
  Could not connect to host
  </code></pre>
  
  <p>Strangely, connecting to <a href="http://test.salesforce.com" rel="nofollow">http://test.salesforce.com</a> (without SSL) or connecting to <a href="https://login.salesforce.com" rel="nofollow">https://login.salesforce.com</a> (with SSL) works as expected.</p>
  
  <p>I even managed to log into <a href="https://test.salesforce.com" rel="nofollow">https://test.salesforce.com</a> using soapUI.</p>
  
  <p>So my guess is there has to be some certification/handshake problem but i can't figure out how to get a more detailed error message or how to change anything about the toolkit setup.
  I searched google, stackoverflow and the SalesForce discussion boards but nobody seems to have this specific sandbox+SSL problem.</p>
  
  <p>Does anyone have a clue how to debug this problem?</p>
  
  <hr>
  
  <p>OK, i think it's an issue with macports' openssl binary. Apparently the handshake fails because my client is attempting a SSLv2/SSLv3 handshake which the server does not understand.</p>
  
  <pre><code>openssl s_client -connect test.salesforce.com:443 -state
  CONNECTED(00000003)
  SSL_connect:before/connect initialization
  SSL_connect:SSLv2/v3 write client hello A
  
  [...end...]
  </code></pre>
  
  <p>Same command with forced SSLv3:</p>
  
  <pre><code>openssl s_client -ssl3 -connect test.salesforce.com:443 -state
  CONNECTED(00000003)
  SSL_connect:before/connect initialization
  SSL_connect:SSLv3 write client hello A
  SSL_connect:SSLv3 read server hello A
  depth=1 O = VeriSign Trust Network, OU = "VeriSign, Inc.", OU = VeriSign International Server CA - Class 3, OU = www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
  verify error:num=20:unable to get local issuer certificate
  verify return:0
  SSL_connect:SSLv3 read server certificate A
  SSL_connect:SSLv3 read server done A
  SSL_connect:SSLv3 write client key exchange A
  SSL_connect:SSLv3 write change cipher spec A
  SSL_connect:SSLv3 write finished A
  SSL_connect:SSLv3 flush data
  SSL_connect:SSLv3 read finished A
  
  [...and so forth...]
  </code></pre>
  
  <p>Not really sure what to make out of this... the SalesForce toolkit-for-php uses PHP's native SoapClient and I don't know how to force it to use SSLv3.</p>