出现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. Javascript高级程序设计--读书笔记之面向对象(一)

    哈哈哈万物皆对象,终于到了js的面向对象篇. 一.属性类型 (1)数据属性 数据属性包含一个数据值的位置,在这个位置可以写入和读取数值,数据属性有四个描述器行为的特性 [[Configurable]] ...

  2. imagepicker插件的使用方法和选择按钮汉化

    1,使用cordova-plugin-image-picker插件. cordova plugin add https://github.com/wymsee/cordova-imagePicker. ...

  3. 惠普笔记本Ubuntu系统HDMI无输出

  4. java笔试题大全之IO流常见选择题

    1.下面哪个流类属于面向字符的输入流()选择一项)A. BufferedWriterB. FileInputStreamC. ObjectInputStreamD. InputStreamReader ...

  5. React 使用antd 清空表单

    handleResetClick = e => { this.props.form.resetFields();};

  6. 非关系型数据库MongoDB入门

    本文分为以下四块简单介绍非关系型数据库MongoDB:1.MongoDB简介.2.MongoDB和关系数据库对比.3.MongoDB基本概念.4.mongo shell的使用以及对MongoDB的增删 ...

  7. ElasticSearch---初识

    1.概述 1.1 ElasticSearch是一个   基于Lucene   的  搜索服务器: 1.2 ElasticSearch 提供了一个分布式多用户能力的全文搜索引擎,基于  RESTful ...

  8. Java之数据库连接池

    未使用数据库连接池,需要从底层申请数据库连接来访问数据库,访问结束之后需要把链接丢弃.长此以往浪费时间. 数据库连接池就是用容器来申请访问,容器里有很多连接对象,用户来容器里拿一个连接对象一起访问数据 ...

  9. 接口使用Http发送post请求工具类

    HttpClientKit import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamR ...

  10. EL表达式的简单介绍

    EL表达式的简单介绍 一.JSP EL语言定义 E L(ExpressionLanguage)  目的:为了使JSP写起来更加简单. 表达式语言的灵感来自于ECMAScript 和 XPath 表达式 ...