免费PHP万能建站系统_社区团购SaaS_商城系统_软件开发_虚拟币交易所系统_矿机系统_微信钻石投票系统_成品源码

标题: file_get_contents(): SSL operation failed with code 1. OpenSSL Error message [打印本页]

作者: admin    时间: 2023-11-29 22:42
标题: file_get_contents(): SSL operation failed with code 1. OpenSSL Error message

今天跑之前写的一个采集,提示错误:

file_get_contents(): SSL operation failed with code 1. OpenSSL Error message

以为是升级了PHP版本到7.4的原因,结果换回原来的7.3的也提示,顺便解决了一下。

在file_get_contents前面加个配置,忽略证书验证即可。主要这里是采集,没必要做证书校验。

调整后代码:


$option=array('ssl'=>array('verify_peer' => false,'verify_peer_name' => false));

$html = file_get_contents($rd['content_url'],false,stream_context_create($option));









欢迎光临 免费PHP万能建站系统_社区团购SaaS_商城系统_软件开发_虚拟币交易所系统_矿机系统_微信钻石投票系统_成品源码 (http://www.ourphp.net/club/) Powered by Discuz! X3.2