首页 > 技术文章 > file_get_contents无法获取到https链接内容问题

shensss 原文

         $options = array(
            'http' => array(
                'method' => 'POST',
                'header' => 'Content-type:application/x-www-form-urlencoded;charset=UTF-8',
                'content' => $stringData//需要获取的内容
            ),
            // 解决SSL证书验证失败的问题
            "ssl"=>array(
                "verify_peer"=>false,
                "verify_peer_name"=>false,
            )
        );
        $context = stream_context_create($options);
        $data = file_get_contents($url, false, $context);

推荐阅读