file_get_contents(): Peer certificate did not match

Temporary fixing:

$context = stream_context_create(array(
                    'http' => array(
                        'method' => 'POST',
                        'header' => 'Content-Type: application/json',
                        'content' => $encryptedEncodedData,
                        ),
                    'ssl' => array(
                        'verify_peer'      => false,
                        'verify_peer_name' => false,
                        ),
                    )
                );

Thanks for everyone


This works for me. The key was setting 'allow_self_signed' to TRUE.

    stream_context_set_default(array(
            'ssl'                => array(
            'peer_name'          => 'generic-server',
            'verify_peer'        => FALSE,
            'verify_peer_name'   => FALSE,
            'allow_self_signed'  => TRUE
             )));


    $response = file_get_contents($url, FALSE);

Tags:

Php