title: PHP - Errors with get_headers and SSL
body: <p>This is my code</p>
  
  <pre><code>$url = 'http://www.wikipedia.com';  // URL WITH HTTP
  $hurl = str_replace("http", "https", $url); // URL WITH HTTPS
  
  $urlheads = get_headers($url, 1);   
  $surlheads = get_headers($hurl, 1);     
  $urlx = false;
  $surlx = false;
  
  foreach ($urlheads as $name =&gt; $value) 
  {
      if ($name === 'Location') 
      {
          $urlx=$value;   
      }
      else{
  
      }
  }
  print_r($urlx);
  </code></pre>
  
  <p>And this is error I'm getting:</p>
  
  <pre><code>Warning: get_headers(): Peer certificate CN=`*.wikipedia.org' did not match expected CN=`www.wikipedia.com' in....
  
  Warning: get_headers(): Failed to enable crypto in....
  
  Warning: get_headers(https://www.wikipedia.com): failed to open stream:     operation failed in .....
  Array ( [0] =&gt; http://www.wikipedia.org/ [1] =&gt; https://www.wikipedia.org/ )
  </code></pre>
  
  <p>Why is this happening and what is proper way to get headers from https page without errors (without curl). Also, when I try on some other https site everything is ok</p>