file_get_contents无法请求https连接的解决方法
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连接的解决方法的更多相关文章
- file_get_contents无法请求https连接的解决方法 php开启curl
file_get_contents无法请求https连接的解决方法 方法1: PHP.ini默认配置下,用file_get_contents读取https的链接,就会如下错误: Warning: fo ...
- 解决file_get_contents无法请求https连接的方法
PHP.ini默认配置下,用file_get_contents读取https的链接,就会报如下错误,本文给出解决方法 错误: Warning: fopen() [function.fopen]: Un ...
- ssh 连接缓慢解决方法
ssh 连接缓慢解决方法 摘自:https://blog.csdn.net/qq_14821541/article/details/61915589 2017年03月13日 12:00:38 所以怎样 ...
- Linux Vsftpd 连接超时解决方法
Linux Vsftpd 连接超时解决方法 2013-11-13 10:58:34| 分类: 默认分类|举报|字号 订阅 解决方法(http://www.lingdus.com/thread ...
- ssh能够连接而sftp不能连接的解决方法
ssh能够连接而sftp不能连接的解决方法 昨天开始用FileZilla一直不能登录远程的服务器,ssh的登录就OK,因为是服务器,也不敢乱动.查了好多资料终于解决了. 首先,查看一下系统的安全日 ...
- 因修改/etc/ssh权限导致的ssh不能连接异常解决方法
因修改/etc/ssh权限导致的ssh不能连接异常解决方法 现象: $ssh XXX@192.168.5.21 出现以下问题 Read from socket failed: Connection r ...
- Linux Vsftpd 连接超时解决方法(被动模式)
http://blog.csdn.net/qq_15766181/article/details/46554643 使用 FileZilla FTP Client 连接 Vsftpd FTP,在没有配 ...
- CentOS6.5 ssh远程连接缓慢解决方法
UseDNS no GSSAPIAuthentication no 1.适用命令及方案如下:[远程连接及执行命令]ssh -p22 root@10.0.0.19ssh -p22 root@10.0.0 ...
- CentOS 6 下无法wget https链接的解决方法
CentOS6下最高版本的wget是1.11,但非常遗憾的是这个版本有bug,是没办法用来下载https链接的东西的,所以有些人为了避免这种情况会帮脚本加上不检查ssl的参数--no-check-ce ...
随机推荐
- Gerald and Giant Chess
Gerald and Giant Chess time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- 设置span 宽度的完美解决方案
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- iptables-过滤61开头的ip数据包
iptables -F root@android:/system/bin # iptables -L -n iptables -L -n Chain INPUT (policy ACCEPT) tar ...
- 转:Loadrunner上传文件解决办法(大文件)
最近再做一个跟海量存储相关的项目测试,需要通过LR模拟用户大量上传和下载文件,请求是Rest或Soap,同时还要模拟多种大小尺寸不一的文件 通常情况下,都是使用简单的post协议即可: 方法一: we ...
- HaiHongOJ 1003 God Wang
题目连接:http://oj.haihongblog.com/problem.php?id=1003 线段树维护区间最小值,并且求解下标 #include <stdio.h> #inclu ...
- CentOS新增开机启动项
编辑rc.local文件 vi /etc/rc.d/rc.local 例如 #!/bin/sh # # This script will be executed *after* all the oth ...
- Linux服务器软件安装备忘
1.Centos安装Mysql --安装 yum install mysql-server 卸载 yum -e mysql-server --设置为开机启动 chkconfig mysqld on - ...
- 关于js的连续赋值
首先,来看一个经典的案例: <script>var a = {n: 1}var b = a;a.x = a = {n: 2}alert(a.x);alert(b.x);</scrip ...
- Git 常用命令速查表(三)
http://blog.csdn.net/sunboy_2050/article/details/7529841
- 在Ubuntu 14.04 64bit上安装StarUML 2.5版本
1,在“http://staruml.io/”下载: 2,sudo dpkg -i StarUML-v2.5.0-64-bit.deb安装. 3,注册 .在help中输入.name:maxiongyi ...