Making a connection in PHP using TLS

前端 未结 4 1644
北恋
北恋 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:15

    This is enough to open a TLS connection:

    $context = stream_context_create();
    
    $fp = stream_socket_client('tls://'.$host.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context)
    

    if the certificates are in their place. If they are not, follow the instructions linked by Filippos.

提交回复
热议问题