I nicked this code from another question here on StackOverflow I cannot find right now. This is posting between two php-files.
$host=//target host
$path=//path to post file;
$vars=//string to send
$fp=fsockopen($host,80,$errno,$errstr,2);
if(!$fp){
$echo 'Connection failed';die;
}
else{
$out ="POST ".$path." HTTP/1.1\r\n";
$out.="Host: ".$host."\r\n";
$out.="Content-Type: application/x-www-form-urlencoded\r\n";
$out.="Content-Length: ".strlen($vars)."\r\n";
$out.="Connection: Close\r\n\r\n";
$out.=$vars."\r\n";
$par=fwrite($fp,$out);
fclose($fp);
}
The advantage from this above file_get_contents
is it doesn't wait for a response, because it kills the connection after the post. The disadvantage: you never know if the post is processed by the receiving end;