Curl request is failing on the SSL?

后端 未结 7 1933
走了就别回头了
走了就别回头了 2020-12-14 18:09

I have this code

    if(ereg(\"^(https)\",$url))
        curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
    // execute, and log the result to curl_put.log
         


        
7条回答
  •  失恋的感觉
    2020-12-14 19:13

    I encountered a similar cryptic error while working with a third-party library. I tried the CURLOPT_SSL_VERIFY[PEER|HOST] but it made no difference. My error message was similar:

    SSL read: error:00000000:lib(0):func(0):reason(0), errno 54
    

    So I visited http://curl.haxx.se/libcurl/c/libcurl-errors.html, looking for the error code 54.

    CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default!
    

    This was wrong though - I was making other HTTPS requests using curl in other parts of the application. So I kept digging and found this question, R & RCurl: Error 54 in libcurl, which had this gem:

    The output you see is from lib/ssluse.c in libcurl's source code and the "errno" mentioned there is not the libcurl error code but the actual errno variable at that time.

    So, don't let the output of curl_error() mislead you. Instead, use curl_errno() to obtain the correct error code, which in this case was actually 56, CURLE_RECV_ERROR. Had the wrong host name...

提交回复
热议问题