卷曲请求在SSL上失败?

Mat*_*iby 19 php curl libcurl

我有这个代码

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


    $error = curl_error($curl);
Run Code Online (Sandbox Code Playgroud)

指定的错误是

SSL read: error:00000000:lib(0):func(0):reason(0), errno 104
Run Code Online (Sandbox Code Playgroud)

关于事业的任何想法

Nic*_*ero 30

我在使用第三方库时遇到了类似的神秘错误.我尝试过,CURLOPT_SSL_VERIFY[PEER|HOST]但它没有任何区别.我的错误消息类似:

SSL read: error:00000000:lib(0):func(0):reason(0), errno 54
Run Code Online (Sandbox Code Playgroud)

所以我访问了http://curl.haxx.se/libcurl/c/libcurl-errors.html,寻找错误代码54.

CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default!
Run Code Online (Sandbox Code Playgroud)

这是错误的 - 我在应用程序的其他部分使用curl进行其他HTTPS请求.所以我一直在挖掘并发现这个问题,R&RCurl:libcurl中的错误54,它有这个宝石:

您看到的输出来自libcurl源代码中的lib/ssluse.c,并且提到的"errno"不存在libcurl错误代码,而是当时的实际errno变量.

所以,不要让curl_error()的输出误导你.相反,使用curl_errno()来获取正确的错误代码,在这种情况下实际上是56,CURLE_RECV_ERROR.有错误的主机名...


Sar*_*raz 12

使用SSL,请确保您已从php.ini打开openssl扩展.