最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
file_get_contents()获取https出现这个错误Unable to find the wrapper “https”
时间:2022-06-24 16:41:30 编辑:袖梨 来源:一聚教程网
file_get_contents()获取https出现这个错误Unable to find the wrapper “https” – did
解决办法一,如果你是用的服务器,可以参考这个办法,修改php配置文件(win主机),来支持https
在php.ini中找到并修改
extension=php_openssl.dll
allow_url_include = On
重启服务就可以了,如果你的是linux服务器,linux下的PHP,就必须安装openssl模块,安装好了以后就可以访了。
解决办法二,如果你用的不是服务器,你用的主机,你没法更改php的配置,你可以通过使用curl函数来替代file_get_contents函数,当然你的主机必须支持curl函数。
function getSslPage($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
echo getSslPage($_GET['url']);
?>
检查主机是否支持php的file_get_contents函数
讲一下代码存储为php文件,在空间运行,即可得出结果。
echo ‘Curl: ‘, function_exists(‘curl_version’) ? ‘Enabled’ : ‘Disabled’ . ‘
file_get_contents: ‘, file_get_contents(__FILE__) ? ‘Enabled’ : ‘Disabled’;
?>
相关文章
- ps给人物制作添加影子效果教程 07-01
- 金铲铲之战s14超频源计划纳亚菲利阵容搭配推荐 07-01
- Pi2Day之后暴跌,用户怒斥“割韭菜”? 07-01
- 燕云十六声金妙音石归鸿速刷方法 07-01
- 天堂或地狱?Bernstein看好Circle股价再涨30%、摩根大通则看衰股价会腰斩 07-01
- 绝区零薇薇安驱动搭配选择推荐 07-01