I'm trying to get an SSL connection using fsockopen but it's giving me this error.

Originally Posted by
PHP error
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.domain.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in [__my path__] on line 291
Here's my fsockopen code:
PHP Code:
function sendToHost($host,$port=80,$method,$path,$data,$useragent=0)
{
$buf='';
// Supply a default method of GET if the one passed was empty
if (empty($method)) {
$method = 'GET';
}
$method = strtoupper($method);
$fp = fsockopen($host, $port,$errNo,$errStr);
if (!$fp) {
die('<div class="error"><strong>PHP:</strong> Error connecting to '.$host.'</div>');
}
if ($method == 'GET') {
$path .= '?' . $data;
}
fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp,"Content-type: application/x-www-form- urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($data) . "\r\n");
if ($useragent) {
fputs($fp, "User-Agent: MSIE\r\n");
}
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST') {
fputs($fp, $data);
}
while (!feof($fp)) {
$buf .= fgets($fp,128);
}
fclose($fp);
if (empty($errStr)) {
return $buf;
}
else {
return $errStr;
}
}
Normal HTTP connections work, but not HTTPS connections. It says I need to configure it in PHP, but I don't know where to start.
I'm lost.
Bookmarks