php get_headers 报错 get_headers(): SSL operation failed with code 1. OpenSSL Error messages
前段时间写的一个影视站采集 使用 get_headers
函数获取请求头 是否有效,以前没注意到https 会出错,刚好今天采集到https 类链接地址发现了报错问题。
报错信息:
使用 get_headers
函数获取请求头时,报了下面的错。
get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
ssl证书:
这是因为你访问的URL没有有效的ssl证书
That error occurs when you're trying to access a URL without a valid SSL certificate. You can work around this by overriding the default stream context, which will affect all subsequent file operations (including remote URLs)
解决方法:
在get_headers前增加下面的代码
管理员设置 回复 可见隐藏内容
黑蜘蛛
评论
33条评论★霍伟东★ Lv.1
Chrome 110.0.0.0
Windows 回复
四川省绵阳市 电信
超 Lv.1
Chrome 103.0.0.0
Windows 7 回复
厉害
浙江省嘉兴市 电信
磊 Lv.1
Firefox 109.0
Windows 回复
厉害回复了
山西省太原市 联通
ZHDC Lv.1
Chrome 96.0.4664.110
Windows 回复
广东省深圳市 联通
哒哒 Lv.1
Chrome 63.0.3239.132
Windows 回复
学习
中国 移动
356572119 Lv.1
Chrome 107.0.0.0
Windows 回复
学习
河南省驻马店市 电信
1111 Lv.1
Chrome 95.0.4638.69
Windows 回复
学习
河南省驻马店市 联通
京帮帮 Lv.1
Chrome 86.0.4240.198
Windows 回复
新人报道
福建省厦门市 电信
12345 Lv.1
Chrome 99.0.4844.84
Windows 回复
新人报道
学习一下
美国 Computer
轨迹 Lv.1
Chrome 86.0.4240.198
Windows 回复
学习
浙江省温州市 联通