gpt4 book ai didi

php - 错误 :14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

转载 作者:太空宇宙 更新时间:2023-11-03 14:27:53 24 4
gpt4 key购买 nike

我正在尝试连接到需要授权证书的服务,我在我的机器上导入证书,当我通过我的 google chrome 浏览器直接访问服务器时,它给了我完美的结果,但是当我从php curl 请求它给我 sslv3 警报握手失败错误。(error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure)

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://example.com",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_CIPHER_LIST => SSLv3,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_SSLVERSION => 7,
CURLOPT_SSLVERSION => 7,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

var_dump($response);
var_dump($err);

最佳答案

您需要将证书导入 CURL 并设置任何需要的选项

  $caFile = "ca.pem";
$keyFile = "key.pem";
$certFile = "client.pem";
$certPass = "xxxxxx";

curl_setopt($ch, CURLOPT_CAINFO, $caFile);
curl_setopt($ch, CURLOPT_SSLKEY, $keyFile);
curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $certPass);

您可以查看每个 CURL 选项的信息 from here

关于php - 错误 :14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55351516/

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