一、说明二、原因三、解决1、Linux服务器配置https ssl证书;2、curl_ 请求获取内容(见下面的方法curlGet())3、使用file_get_contents()函数跳过
function curlGet($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (windows NT 6.1; WOW64) AppleWEBKit/537.36 (Khtml, like Gecko) Chrome/55.0.2883.87 Safari/537.36'); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $content = curl_exec($ch); curl_close($ch); return ($content); }
$streamOpts = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false ] ]; $html = file_get_contents($pageUrl, false, stream_context_create($streamOpts));
来源地址:https://blog.csdn.net/qq_36025814/article/details/126919045
--结束END--
本文标题: PHP报错:Warning: file_get_contents(): Failed to enable crypto
本文链接: https://www.lsjlt.com/news/391144.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0