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

        经常用file_get_contents()函数调用远程API,这次在使用时,提示SSL什么鬼,一想,可能是函数使用时验证证书,之前写的时候是正常的,但是过了一久就错误了,干脆就关闭验证。

$stream_opts = [ "ssl" => [ "verify_peer"=>false,
"verify_peer_name"=>false,
]
];
$response = file_get_contents("https://xxx.xxx.xxx",false, stream_context_create($stream_opts));
$stream_opts = [    "ssl" => [        "verify_peer"=>false,
        "verify_peer_name"=>false,
    ]
]; 
$response = file_get_contents("https://xxx.xxx.xxx",false, stream_context_create($stream_opts));
$stream_opts = [ "ssl" => [ "verify_peer"=>false, "verify_peer_name"=>false, ] ]; $response = file_get_contents("https://xxx.xxx.xxx",false, stream_context_create($stream_opts));
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
The greatest test of courage on earth is to bear defeat without losing heart.
世界上对勇气的最大考验是忍受失败而不丧失信心
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容