Reputation: 1163
It is possible in PHP to initiate a SSL connection, having PHP/OS handle the specific details of the handshake and encryption by using stream_context
builtin objects, or by using the built-in CURL
system.
Using the C-like basic older functions, it's also possible to make a regular connection by using fsockopen
.
Now there's an answer to this very question supplied for the C
programming language (although this answer is more complex; it has both a server and a client, while I'm only interested in writing the client bit). This question is: what is the PHP equivalent of doing this?
E.g. I have a regular socket created using fsockopen
or stream_context
, how do I change it to a non-regular socket (as obviously; the naïve approach of manually coding ssl is a bad idea)?
Some purposes of this include various protocols which had SSL retro-fitted over the old protocol and must be instantiated as regular non-encrypted connections: the handshake happens after various protocol-specific messages (example: SMTP)
Upvotes: 1
Views: 592
Reputation: 1313
It seems that the built-in stream_socket_enable_crypto
function provides this.
Upvotes: 0