gpt4 book ai didi

php - Curl 请求在 SSL 上失败?

转载 作者:IT王子 更新时间:2023-10-29 00:01:01 27 4
gpt4 key购买 nike

我有这个代码

    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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com