I have tried and tried again to get the PostToHost function working and I keep getting
Supplied argument is not a valid File-Handle resource in [path and name of file] line x
I have checked and checked again the syntax below and it looks just fine to me (and I know I have used this before with success).
<?php
function PostToHost($host, $path, $data_to_send) {
$fp = fsockopen($host,80);
fputs($fp, "POST $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, $data_to_send);
while(!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>