954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Fread + Ssl

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.")\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.

John Smith
Newbie Poster
2 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

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)

Warning: fgets(): SSL: fatal protocol error in /home/william/public_html/hotmail.php on line 46

(14).... (page content)

John Smith
Newbie Poster
2 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You