I am having problem in establishing a SSL connection to remote server using PHP socket client.
Connecting to simple socket server is easy but SSL connection is keeping a live and doesn't respond anything, please look at the code below and guide me what mistake I am doing in the following code.
Page is keep loading but doesn't respond anything.
// command array
$command = array(
'command' => 'login',
'arguments' => array(
'userId' => 'xxxxxx',
'password' => 'xxxxxx',
'appId' => 'test',
'appName' => 'test',
),
);
$fp = stream_socket_client("ssl://xapia.x-station.eu:5124", $errno, $errstr, 30);
if (!$fp) {
die("Unable to connect: $errstr ($errno)");
}
/* Turn on encryption for login phase */
fwrite($fp, json_encode($command));
while ($motd = fgets($fp)) {
echo $motd;
echo '<hr />';
}
fclose($fp);