file_get_contents(): SSL operation failed with code 1

旧街凉风 提交于 2019-11-26 23:42:33

出现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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!