curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
         //这具体有什么实际作用不 ?  举个例子说明下啊
 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
//还有这个 具体有什么实际作用不 ?  举个例子说明下啊

解决方案 »

  1.   


             
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查。0不检查
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); // 从证书中检查SSL加密算法是否存在。0不检查
      

  2.   

    FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2). 
    仔细看看这个,然后看看例子If you want to connect to a server which requires that you identify yourself with a certificate, use following code. Your certificate and servers certificate are signed by an authority whose certificate is in ca.ctr.
    <?php
    curl_setopt($ch, CURLOPT_VERBOSE, '1');
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '1');
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1');
    curl_setopt($ch, CURLOPT_CAINFO,  getcwd().'/cert/ca.crt');
    curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/cert/mycert.pem');
    curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'password');
    ?>
    If your original certificate is in .pfx format, you have to convert it to .pem using following commands
    # openssl pkcs12 -in mycert.pfx -out mycert.key
    # openssl rsa -in mycert.key -out mycert.pem
    # openssl x509 -in mycert.key >> mycert.pem
    哥们  多看看手册吧!