...
PHP

PHP读取远程URL出现 file_get_contents(): SSL operation failed with code 1. OpenSSL

get_file_contents() 这个函数想必大家都很熟悉了吧,在最近项目功能中,需要采集远程的图片资源,但是在使用 get_file_contents()时,出现 file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL

但是,在读取其他网站的URL是没有问题的

出现上面的原因,属于SSL证书不一致造成,我们只需要在 get_file_contents() 这个函数中,这样处理就可以了。

$arrContextOptions = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
]
];
$response = file_get_contents($voucherImageBase64, false, stream_context_create($arrContextOptions));


vue 脚手架 sass安装 雨霖铃·寒蝉凄切
biu biu biu
Windows 10系统连接共享打印机报错0x00000709、0x0000007c、0x0000011b Android Java ASE加解密与PHP AES加解密 Nginx反向代理是什么,及反向代理的基本配置 php文件缓存类,简单的文件缓存 js生成日期,昨天、前天、今天、明天、一周后日期生成