I've searched the posts on SSL and fsockopen, but I can't get it to work.
Here's a basic example my code to create an SSL connection:
<?php
error_reporting(E_ALL);
/ Get the port for the WWW service. /
$service_port = 9001;
/ Get the IP address for the target host. /
$address = gethostbyname('ssl://test.server.com');
$fp = fsockopen($address, $service_port);
$in = "<?xml version='1.0' encoding='ISO-8859-1'?>";
$in .= "<xml>Test message to server</xml>";
$in .= "\7";
$out = '';
echo "Sending message...<p>";
fwrite($fp,$in);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
echo "OK<br>";
?>
I'm supposed to connect to the remote server with a secure socket using the remote server's public key. I'm not sure if I am supposed to use an openssl function here, but so far I'm not getting anywhere. I'm not sure where I would put in their public key. The error message I keep getting is "no SSL support in this build." I did install OpenSSl and in phpinfo(), OpenSSL is enabled. What am I doing wrong or what should I be doing? How do the openssl functions relate to fsockopen for creating sockets? Any clues or links to tutorials would be greatly appreciated.