reading SSL page with CURL (php)

后端 未结 7 1898
南方客
南方客 2020-12-05 00:24

I am trying to download the content of a secure (uses https) webpage using php and curl libraries.

However, reading failed and I get error 60: \"SSL certificate prob

7条回答
  •  半阙折子戏
    2020-12-05 00:46

    Even after following advice on SO.. You may still have problems with an error like:

    error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error
    

    the problem is with the SSL version. Use the following for version 3

    curl_setopt($ch, CURLOPT_SSLVERSION,3)
    

    I am assuming that u have enabled verification of peer and host as well and are pointing to an actual certificate file. Eg.

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
    curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/cacert.pem");
    

提交回复
热议问题