如何通过https允许PHP REST请求过期证书

Is there a way to allow PHP doing connections to https urls if the certificate is expired? Something like a security exception in a browser.

The following code will not work if the certificate is expired but it works well, if the certificate is valid.

<?php

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://myURL/...,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "authorization: Basic abcdefghijkl",
        "cache-control: no-cache",
    ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
<?php

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://myURL/...,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "authorization: Basic abcdefghijkl",
        "cache-control: no-cache",
    ),
    CURLOPT_SSL_VERIFYPEER => false
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);