php file_get_contents 忽略证书

$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 函数证书问题;

2、file_get_contents SSL operation failed with code 1 SSL3_GET_SERVER_CERTIFICATE certificate verify failed

你可能感兴趣的:(php file_get_contents 忽略证书)