Hello Residents of HashCode, my question is about sockets in php and https. Here is the code that knocks on the http server

... fwrite($socket, "POST /post/test.php HTTP/1.1\r\n"); fwrite($socket, "Host: www.example.loc\r\n"); ... 

But how to perform the same request via the https protocol (I need to know what to write for the HTTP / 1.1 place).

    1 answer 1

    You do not need to write instead of HTTP/1.1 (do not think out the answers).

    In PHP, sockets normally go on a protected transport. Writing is simple:

     $socket = fsockopen("ssl://www.example.org", 443, $errno, $errstr, 60); 

    that is, first, do not forget the correct port, and second, use the ssl:// scheme