出现file_get_contents(): SSL operation failed with code 1的错误

方法需要添加参数,如下:

$stream_opts = [
"ssl" => [
"verify_peer"=>false,
"verify_peer_name"=>false,
]
]; $response = file_get_contents("https://www.example.com",
false, stream_context_create($stream_opts));

解決方法參考:

  1. file_get_contents(): SSL operation failed with code 1. And more
  2. ile_get_contents SSL operation failed with code 1 SSL3_GET_SERVER_CERTIFICATE certificate verify failed

file_get_contents(): SSL operation failed with code 1的更多相关文章

  1. 安装 composer SSL operation failed with code 1

    gavin@webdev:~> curl -sS https://getcomposer.org/installer | php Downloading... Download failed: ...

  2. phpmailer发送邮件出现错误:stream_socket_enable_crypto(): SSL operation failed with code 1.

    如果开了调试,调试进去会看到错误提示: smtp_code:"stream_socket_enable_crypto(): SSL operation failed with code 1. ...

  3. composer在update时提示file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO

    在开发的时候,需要把依赖的服务更新到最新,然后 手动composer update一下,提示如下: failed) Update failed (The "e "https://a ...

  4. 使用PHPMailer 中的报错解决 "Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:"

    PHPMailer项目地址:https://github.com/PHPMailer/PHPMailer 项目中用到PHPMailer,使用过程中报错:"Connection failed. ...

  5. composer 安装提示 PHP Warning: readfile(): SSL operation failed with code 1

    这是php设置openssl 没有指定cacert.pem (证书) 第一步:下载 cacert.pem 文件下载地址 https://curl.haxx.se/docs/caextract.html ...

  6. PHP函数file_get_contents()使用 https 协议时报错:SSL operation failed

    场景: file_get_contents() 函数是用于将文件的内容读入到一个字符串中,是读取文件内容常用的函数之一. 但是有时在服务器上使用file_get_contents() 函数请求http ...

  7. failed to open stream: operation failed

    # composer require oygza/aliyun-php-sdk-afs You are running composer with xdebug enabled. This has a ...

  8. Error: ORA-16501: the Data Guard broker operation failed ORA-16625: cannot reach database

    在备库上建配置文件 DGMGRL> create configuration 'sharkdbbork' as primary database is 'sharkdb' connect ide ...

  9. hive subprocess failed with code X 的错误码对应信息

    PipeMapRed.waitOutputThreads(): subprocess failed with code X ,这里code X对应的信息如下:error code 1: Operati ...

随机推荐

  1. Linux 100个常用指令

    1.ls 列出目录内容. 文件属性: -:普通文件 d:目录文件 b:块设备 c:字符设备文件 l:符号连接文件 p:命令管道 s:套接字文件 文件权限: 9位数字,每3位一组 文件硬链接次数 文件所 ...

  2. 【Luogu】【关卡2-5】字符串处理(2017年10月)

    任务说明:这里的字符串处理还会变得更加的有意思,难度也更大.需要好好地思考一下.

  3. string::size_type 页73 size_t 页90

    异同点: size_t size_type sizeof(XXX)所得到的结果的类型就是 string类类型和vector类类型定义的类型,string的size操作返回来的是string::size ...

  4. 2、Python 接口框架

    common:存放通用的工具类 config:存放配置文件信息 result:存放result.html run_suite.py:最后执行的文件 1.excel_util:利用 openpyxl 进 ...

  5. linux IPC的FIFO

    FIFO命名管道原型: #include <sys/stat.h> int mkfifo(const char *path, mode_t mode); int mkfifoat(int ...

  6. Android中对应用程序的行为拦截实现方式概要

    这次是真的好长时间都没有写博客了,主要不是因为工作上的事,主要还是这个问题真的有点复杂,实现起来有点麻烦,所以研究了很长时间(大约有一个月的时间).但是幸好最后问题搞定了~~ 一.问题场景 想实现36 ...

  7. 记录一次项目中dubbo-admin实战部署

    环境: 1.centos7 2.jdk-7u76-linux-x64.tar.gz 2.tomcat:apache-tomcat-7.0.59.tar.gz 3.zookeeper-3.4.6.tar ...

  8. JS中的call()、apply() 以及 bind()方法用法总结

    JS中的call()方法和apply()方法用法总结  : 讲解: 调用函数,等于设置函数体内this对象的值,以扩充函数赖以运行的作用域. function add(c,d){ return thi ...

  9. HTML-参考手册: Px、Em 换算工具

    ylbtech-HTML-参考手册: Px.Em 换算工具 1.返回顶部 1. Px.Em 换算工具 以下工具提供了em和px的换算工具. 第一个输入框:设置了网页默认的字体像素 (通常 16px) ...

  10. CSS:CSS 属性 选择器

    ylbtech-CSS:CSS 属性 选择器 1.返回顶部 1. CSS 属性 选择器 具有特定属性的HTML元素样式 具有特定属性的HTML元素样式不仅仅是class和id. 注意:IE7和IE8需 ...