PHP.ini默认配置下,用file_get_contents读取https的链接,就会如下错误:

Warning: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

解决方案有3:
1.windows下的PHP,只需要到php.ini中把extension=php_openssl.dll前面的;删掉,重启服务就可以了。

1、打开PHP目录,在php.ini中把“extension=php_openssl.dll”前面的“;”去掉
2、复制php安装目录中的: libeay32.dll、ssleay32.dll至c:windowssystem32
3、复制php_openssl.dll至c:windowssystem32
4、重启IIS或者apache环境
这样就可以打开php的openssl_open支持,继续安装了

2.linux下的PHP,就必须安装openssl模块,安装好了以后就可以访问了。
3.如果服务器你不能修改配置的话,那么就使用curl函数来替代file_get_contents函数

 /**-- curl for https --**/
function curl_for_https($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//不加下面的 返回的就是 access_token=F5A4FEDE95AD3D88DD29EC1F904B24C8&expires_in=7776000&refresh_token=2BF2DD1B05CF510CD2EEE2466009EFC0bool(true)
//并且页面直接输出后 就不向下执行了
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}

file_get_contents无法请求https连接的解决方法的更多相关文章

  1. file_get_contents无法请求https连接的解决方法 php开启curl

    file_get_contents无法请求https连接的解决方法 方法1: PHP.ini默认配置下,用file_get_contents读取https的链接,就会如下错误: Warning: fo ...

  2. 解决file_get_contents无法请求https连接的方法

    PHP.ini默认配置下,用file_get_contents读取https的链接,就会报如下错误,本文给出解决方法 错误: Warning: fopen() [function.fopen]: Un ...

  3. ssh 连接缓慢解决方法

    ssh 连接缓慢解决方法 摘自:https://blog.csdn.net/qq_14821541/article/details/61915589 2017年03月13日 12:00:38 所以怎样 ...

  4. Linux Vsftpd 连接超时解决方法

    Linux Vsftpd 连接超时解决方法 2013-11-13 10:58:34|  分类: 默认分类|举报|字号 订阅     解决方法(http://www.lingdus.com/thread ...

  5. ssh能够连接而sftp不能连接的解决方法

    ssh能够连接而sftp不能连接的解决方法   昨天开始用FileZilla一直不能登录远程的服务器,ssh的登录就OK,因为是服务器,也不敢乱动.查了好多资料终于解决了. 首先,查看一下系统的安全日 ...

  6. 因修改/etc/ssh权限导致的ssh不能连接异常解决方法

    因修改/etc/ssh权限导致的ssh不能连接异常解决方法 现象: $ssh XXX@192.168.5.21 出现以下问题 Read from socket failed: Connection r ...

  7. Linux Vsftpd 连接超时解决方法(被动模式)

    http://blog.csdn.net/qq_15766181/article/details/46554643 使用 FileZilla FTP Client 连接 Vsftpd FTP,在没有配 ...

  8. CentOS6.5 ssh远程连接缓慢解决方法

    UseDNS no GSSAPIAuthentication no 1.适用命令及方案如下:[远程连接及执行命令]ssh -p22 root@10.0.0.19ssh -p22 root@10.0.0 ...

  9. CentOS 6 下无法wget https链接的解决方法

    CentOS6下最高版本的wget是1.11,但非常遗憾的是这个版本有bug,是没办法用来下载https链接的东西的,所以有些人为了避免这种情况会帮脚本加上不检查ssl的参数--no-check-ce ...

随机推荐

  1. UINavigationItem不显示

    效果如图: 代码: self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithNormalImage:@"MainTa ...

  2. 转:web_custom_request 函数

    语法:Int web_custom_request (const char *RequestName, <List of Attributes>, [EXTRARES, <List ...

  3. stdarg.h头

    stdarg.h 头文件,主要目的是让函数可以接受可变参数. va_list :用来保存宏va_arg与宏va_end所需信息. va_start :使va_list指向起始的参数 va_arg :检 ...

  4. JS——基础知识(二)

    1.变量提升问题 <script> var num=10; fun(); function fun(){ console.log(num); var num=20; } </scri ...

  5. Ubuntu Server PHP常用扩展库的安装

    sudo apt-get install php5-gd curl libcurl3 libcurl3-dev php5-curl

  6. 如何理解java的引用传递

    1. 数组的引用传递 public class TestArray { public static void changeAry1(int[] ary){ int[] ary1 = {9,9,9}; ...

  7. laravel5 html引用问题

    1. Composer 安装 编辑 composer.json 文件, require 节点下增加: "illuminate/html": "~5.0" 然后 ...

  8. Bitmap 格式

    源:Bitmap 格式 参考:bitmap文件格式 Bitmap是Windows操作系统中的标准图像文件格式,可以分成两类:设备相关位图(DDB)和设备无关位图(DIB),DDB已经基本停用. Bit ...

  9. jquery判断对象的type

    利用Object.toString.call()方法 看代码 先初始化class2type,将每种对象的toString后的值和type建立对应关系 core_toString.call([])输出& ...

  10. ajax原理图解

    Ajax 原理图解 摘自: http://www.nowamagic.net/ajax/ajax_PicForAjaxPrinciple.php Ajax其实已经使用很久了,但一直也没有时间正经的找本 ...