Code: Select all
$fp = fsockopen('ssl://domain.com', 443, $errno, $errstr, 30);
if (!$fp) { echo "$errstr ($errno)<br>\n"; } else {
$out = "POST /dir/ HTTP/1.1\r\n";
$out .= "Host: domain.com\r\n";
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
$out .= "Content-length: ".strlen($poststring)."\r\n";
$out .= "Connection: close\r\n\r\n";
$out .= "$poststring \r\n\r\n";
fwrite($fp, $out);
{ while (!feof($fp)) { echo fread($fp, 4096); }}
fclose($fp);
}It usually works just fine but sometimes it can't connect properly and I find this error message in error.log:
PHP Warning: fread(): SSL: fatal protocol error in ...
I can't find the reason for it because it doesn't happen always. Any idea what it could be caused by?
Thanks!
Tomas