title: file_get_contents(): Peer certificate did not match
body: <p>I used PHP 5.5 but I forced to update it and now I'm using PHP 5.6.19.</p>
  
  <p>Now, when I'm trying to communicate with external API I get warning:</p>
  
  <blockquote>
    <p>Warning: file_get_contents(): Peer certificate CN=<code>*.domain.com' did
    not match expected CN=</code>api.domain.com'</p>
  </blockquote>
  
  <p>It hasn't appeared in previous PHP version.</p>
  
  <pre><code>    $encryptedEncodedData // this is json encoded
  //array, then encrypted by mcrypt with rijndael-128 and finally bin2hex.
  
      $context = stream_context_create(array(
                          'http' =&gt; array(
                              'method' =&gt; 'POST',
                              'header' =&gt; 'Content-Type: application/json',
                              'content' =&gt; $encryptedEncodedData,
                          )
                      ));
  
      $api = 'https://api.domain.com/service';
  
      $response = file_get_contents($api, FALSE, $context);
  </code></pre>
  
  <p>I don't know what is reason for this warning.</p>
  
  <hr>
  
  <p>I decided to disable peer verfy until my admins will fix problem with cert and I changed $context following:</p>
  
  <pre><code>$context = stream_context_create(array(
                      'http' =&gt; array(
                          'method' =&gt; 'POST',
                          'header' =&gt; 'Content-Type: application/json',
                          'content' =&gt; $encryptedEncodedData,
                          'verify_peer'      =&gt; false,
                          'verify_peer_name' =&gt; false,
                          ), 
                      )
                  );
  </code></pre>
  
  <p>But still not working. Did I do this correct? Getting same Warning.</p>