I do have the following code to connect to a JAVA Websocket Server:
$service_port = 10;
$address = 'localhost';
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP );
$result = socket_connect($socket, $address, $service_port);
$xml = '<?xml version="1.0" encoding="UTF-8"?><JAVADEMO><Question="Login-Anfrage"/></JAVADEMO>';
$msg_length = strlen( $xml );
$withLength = pack( "Na{$msg_length}", $msg_length, $xml );
$lngLen = strlen( $withLength );
$send_bytes = socket_write( $socket, $withLength, $lngLen );
while ($out = socket_read($socket, 2048)) {
echo $out."<br />";
}
socket_close($socket);
This works perfect.
Now i have to connect to an SSL server. I have tried to change 'localhost' to 'ssl://localhost' or 'ssl://127.0.0.1' or 'ssl://192.168.0.1', .....
Nothings works. Anyone any idea how to connect to an SSL secured server?
EDIT: I was missing something: On the server side, there is no Apache running! It's a Java SSL server.