Protocol https not supported or disabled in libcurl

1.PHP使用curl发送post请求提示标题错误.
2.代码演示

function curlPost($url, $data = array())
{
    if (is_array($data)) {
        $data = http_build_query($data);
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    if (!empty($options)) {
        curl_setopt_array($ch, $options);
    }
    $data = curl_exec($ch);
    recordLog(1,curl_error($ch));
    curl_close($ch);
    return $data;
}

3.问题解决
需要加上如下代码

    // 访问的借口为https协议时
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

4.其它原因
a.有可能url中有空格

这个提示信息说的是https协议不被支持,因此你要把https/ssl协议启用