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.