SSL: Connection reset by peer怎么办?
发布于 4 年前 作者 fangxiuying 13438 次浏览 来自 问答

通过访问https://api.weixin.qq.com进行身份认证,返回如下错误,file_get_contents(): SSL: Connection reset by peer,请问如何解决?

1 回复

建议使用curl函数访问https链接。

file_get_contents 参考下面代码试试

$arrContextOptions = array(
    "ssl" => array(
        "allow_self_signed" => true,
        "verify_peer" => false,
        "verify_peer_name" => false,
    ),
);

file_get_contents("https://域名/", false, stream_context_create($arrContextOptions));



回到顶部