php - Curl 请求在 SSL 上失败?

标签 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);

指定的错误是

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

关于原因的任何想法

最佳答案

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

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

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

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

虽然这是错误的 - 我在应用程序的其他部分使用 curl 发出其他 HTTPS 请求。所以我一直在挖掘,发现了这个问题,R & RCurl: Error 54 in libcurl ,它有这个 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.

所以,不要让 curl_error() 的输出误导你。相反,使用 curl_errno()获取正确的错误代码,在本例中实际上是 56,CURLE_RECV_ERROR。主机名错误...

关于php - Curl 请求在 SSL 上失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3876563/

相关文章:

c++ - 使用 LibCURL C++

android - 使用 Android NDK 将共享库和静态库编译成共享库

php - 在 Sphinx 中使用过滤器执行空查询

python - 使用加密的 PEM 客户端证书调用 REST api

php - 从一个表中获取公司名称并将其插入另一个表时出现问题

php - 这个隐藏输入的正确模式是什么

curl - Golang 中的函数基础

php - Ubuntu 的 DNS 缓存存储在哪里?

php - 根据其值设置复选框

php - json_encode 具有私有(private)属性的对象数组