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. 我的android学习脚步----------- Button 和监听器setonclicklistener

    最基本的学习,设置一个按钮并监听实现实时时刻显示 首先XML布局,在layout中的  activity_main.xml中拖一个Button按钮到相应位置 然后在xml文件中做修改 <Rela ...

  2. we7 数据库

    备份其他we7网站数据库 然后附加数据库,重新命名即可 不能是对其他we7数据库生成脚本,然后执行脚本,因为后台需要一些配置数据 不然后台看不到左侧的工具栏

  3. iptables-过滤61开头的ip数据包

    iptables -F root@android:/system/bin # iptables -L -n iptables -L -n Chain INPUT (policy ACCEPT) tar ...

  4. sina微博上看到的关于android界面设计相关的规范

    图片来自:http://photo.weibo.com/5174249907/wbphotos/large/mid/3777508610941685/pid/005EaCLFjw1emcpzdgrj9 ...

  5. fn标签

    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

  6. Swift中自定义打印方法

    // 1.获取打印所在的文件 let file = ( #file as NSString).lastPathComponent // 2.获取打印所在的方法 let funcName = #func ...

  7. oracle创建游标和输出

    declare  cursor c_test_tbl2 is    select t2.id, t2.salary      from test_tbl2 t2, test_tbl1 t1     w ...

  8. 用Quick Cocos2dx做一个连连看(三)

    做个日记吧. 最近比较忙,斗志也不高,昨天有点时间了,开始做了一下连接方法,一开始用的搜索算法,但是bug比较多,究其原因是对语法和算法都不是很熟悉. 然后昨天下午利用点时间用稍微通俗一点的连接算法, ...

  9. openstack controller ha测试环境搭建记录(一)——操作系统准备

    为了初步了解openstack controller ha的工作原理,搭建测试环境进行学习. 在学习该方面知识时,当前采用的操作系统版本是centos 7.1 x64.首先在ESXi中建立2台用于测试 ...

  10. mysql 不同语法

    http://blog.csdn.net/kesaihao862/article/details/6718443 REPLACE INTO id_28_repayid(stub) VALUES(1); ...