title: How to check that the host name matches Common Name in SSL certificate in PHP?
body: <p>With this PHP script </p>
  
  <pre><code>&lt;?php
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_HTTPGET, true);
  curl_setopt($ch, CURLOPT_URL, 'https://sf.net/');
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  if (!curl_exec($ch)) {
      echo "Error #" . curl_errno($ch) . ": " . curl_error($ch);
  }
  ?&gt;
  </code></pre>
  
  <p>I got no error. This seems to be OK.</p>
  
  <p>The expected result should an error message indicating  that certificate name <code>sourceforge.net</code> does not match expected <code>sf.net</code>. What do you think?</p>