Hi,

Im having a slight problem with fgets and ssl.

<?php


function monkey($method,$protocal,$port,$domain,$path,$data,$query){
	

	if($method=="POST"){


		$fp = fsockopen($protocal."://".$domain, $port, $errno, $errstr, 30);

		if (!$fp) {
			echo $errstr." (".$errno.")<br />\n";
		} else {
			$out .= "POST /".$path."?".$query." HTTP/1.1\r\n";
			$out .= "Host: ".$domain."\r\n";
			$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
			$out .= "Content-Length: " . strlen($req) . "\r\n";
			$out .= "Connection: Close\r\n\r\n";
			$out .= $req;
			
			fputs ($fp, $out);
			while (!feof($fp)) {
				echo fgets($fp, 128);
			}
			fclose($fp);
		}

	}
}
$data['foo']="Hello Post data";
monkey("POST","ssl","443","domaingoeshere.com","",$data,"a=blag");

?>

Fgets throws an error at me.
Is there something obvious that ive done wrong?
Apache is settup correctly and php is compiled with ssl support.

When connecting to hotmail I get this error:
(Through POST and SSL)

(1)HTTP/1.1 200 OK
(2)Cache-Control: no-cache
(3)Pragma: no-cache
(4)Content-Length: 312
(5)Content-Type: text/html
(6)Expires: Fri, 13 May 2005 08:33:37 GMT
(7)Server: Microsoft-IIS/6.0
(8)PPServer: PPV: 25 H: TK2PPMLOG2B03 V: 1192
(9)cachecontrol: no-store
(10)P3P: CP="DSP CUR OTPi IND OTRi ONL FIN"
(11)Date: Fri, 13 May 2005 08:34:36 GMT
(12)Connection: close
(13)
<br />
<b>Warning</b>: fgets(): SSL: fatal protocol error in <b>/home/william/public_html/hotmail.php</b> on line <b>46</b><br />
(14)<HTML><HEAD>.... (page content)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.