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