title: libCURL:: SSL: certificate subject name 'Common Name (eg, YOUR name)' does not match target host name ... but the CN and the target name match
body: <p>So first the error code: </p>
  
  <pre><code>string(345) "
  404 - Not Found
  
  " 
  0
  SSL: certificate subject name 'Common Name (eg, YOUR name)' does not match target host name 'www.example.com'
  </code></pre>
  
  <p>This was found using the following test script. </p>
  
  <pre><code>&lt;?php
  
  $request=&lt;&lt;&lt;EOT
  EOT;
  
  $c = curl_init("https://www.example.com");
  
  curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($c, CURLOPT_POST, "POST");
  curl_setopt($c, CURLOPT_POSTFIELDS, $request);
  curl_setopt ($c, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt ($c, CURLOPT_SSL_VERIFYHOST, 2);
  
  ob_start();
  curl_exec($c);
  $response = ob_get_contents();
  ob_end_clean();
  $curlErrorCode = curl_errno($c);
  $error = curl_error($c);
  
  var_dump($response);
  echo "&lt;br&gt;";
  echo $curlErrorCode."&lt;br&gt;";
  echo $error."&lt;br&gt;";
  
  curl_close ($c);
  ?&gt;
  </code></pre>
  
  <p>The actual site name has been altered, but I have double and triple checked the cert and the names match. It's a premium SSL certificate from Starfield Secure Certificate Authority - G2</p>
  
  <pre><code>Subject section of SSL CERT 
      CN = www.example.com
      O = EXAMPLE, INC.
      L = City
      S = State
      C = US
      SERIALNUMBER = 19xxxxxxxx
      2.5.x.xx = Private Organization
      1.3.x.x.x.x.xxx.xx.x.x.x = State
      1.3.x.x.x.x.xxx.xx.x.x.x = US
  </code></pre>
  
  <p>For our payment system to be in compliance this script has to run cleanly (this site is not live so we are not accepting payments out of compliance). But I have been unable to get it to clear. Anyone have an idea why?</p>
  
  <p>More Information:</p>
  
  <pre><code>OS = MS Server 2012_R2
  Platform = Hyper-v Virtual Instance (Hyper-v is installed on metal on MS Server 2012_R2)
  Service = IIS 6.2 (build 9200)
  Certificate is installed on IIS and bound to website. 
  </code></pre>