curl证书问题如何解决

介绍

curl 是一个命令行工具,用于从服务器获取或发送数据。它可以用来下载、上传、传输数据等,支持多种协议,如
HTTP、HTTPS、FTP、FTPS、SCP、SFTP、TFTP、DICT、TELNET、LDAP 等,curl 支持多种操作系统,如
Linux、Windows、macOS 等

常用方法

curl http://example.com

默认发送get请求
在这里插入图片描述

下载文件

curl -O http://example.com/file.txt

发送post

curl -X POST -d "param1=value1&param2=value2" http://example.com/script.php

添加请求头

curl -H "Content-Type: application/json" -H "Authorization: 123456" http://example.com/api/resource

发送json请求数据

curl -H "Content-Type: application/json" -X POST -d '{"key":"value"}' http://example.com/api/resource

上传文件

curl -T file-to-upload ftp://example.com/path/to/upload

使用代理

curl --proxy http://user:password@proxy-host:port http://example.com

忽略 SSL 证书错误

curl --insecure https://example.com

限制速度下载

curl --insecure https://example.com

证书问题

在这里插入图片描述
错误 curl: (60) SSL certificate problem: unable to get local issuer certificate 表明 curl 在尝试建立 HTTPS 连接时无法验证服务器的 SSL 证书。这可能是由于您的系统缺少必要的证书,或者证书存储不完整。

忽略

如果不需要验证可以直接忽略 --insecure

curl --insecure -X POST -H "Content-Type: application/json" -H "LogAuth: b8a6203e90a62bf35c800470f193a4b03dcf74a5acc1aa5f54db2c4e854cecb6"  -d '{"cmdid":29,"chnid":"001","uuid":"1","playid":"1","vid":"1","videoName":"无HELLo名","sid":"1","snumber":"1","sname":"第一集","duration":10,"bgnTime":1716370575,"tid":"HW1716370575","ts":1716370575}'  https://test.https.com/corp/v1/report

更新证书

安装apt install ca-certificates包

sudo apt install ca-certificates

在这里插入图片描述
验证
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/zhangdonghuirjdd/article/details/142131779