file_get_contents(): Unable to locate certificate CN

前端 未结 1 1242
萌比男神i
萌比男神i 2021-01-28 11:28

We are having two domains ( both https ): one as main domain https://dev.project.com/ and the other for images https://dev-images.project.com/. The frontpage loads the images ju

1条回答
  •  無奈伤痛
    2021-01-28 12:18

    Try to passing the path to your cafile like this.

    $opts=array(
        "ssl"=>array(
            "cafile" => "D:\\wamp64\\cacert.pem",
            "verify_peer"=> true,
            "verify_peer_name"=> true
        )
    );
    
    file_get_contents($url,false,stream_context_create($opts));
    

    edit: if this fails only in your local server, check if you have you added your locally created SSL cert in cacert.pem in your local server and that it contains no errors or extra lines.

    0 讨论(0)
提交回复
热议问题