file_get_contentsでSSL証明書エラーが出たら、
中間証明書が正しく設定されていない可能性があります。
正しい対策は
・相手のサーバーの中間証明書を正しく設定する
あるいは
・curlを使って中間証明書をこちらで補完する
面倒な時は、SSL証明書の検証を行わないオプションをfile_get_contentsに渡すだけでエラーを回避できます。
|
1 2 3 4 5 6 7 8 9 10 11 |
// SSL検証を無効化するオプションを設定 $options = [ "ssl" => [ "verify_peer" => false, "verify_peer_name" => false, ] ]; // コンテキストを作成して、file_get_contents に渡す $context = stream_context_create($options); $response = file_get_contents("https://クライアントのURL", false, $context); |
