Making a connection in PHP using TLS

前端 未结 4 1655
北恋
北恋 2021-01-21 05:20

I wrote a small SIP client for a special purpose. Basically it connects to port 5060 using function fsockopen()

$fp = fsockopen(\"10.0.0.1\", 5060,          


        
4条回答
  •  遇见更好的自我
    2021-01-21 06:14

    I think some of your options are wrong for validating self signed certificates; the following should be enough to make it work:

    $context = stream_context_create([
      'ssl' => [
        'verify_peer' => true,
        'allow_self_signed' => true,
        'local_cert' => 'cert.cer',
      ],
    ]);
    

提交回复
热议问题