The following will allow POST through PHP as if it was submitted from a form in a browser.
<?php
$host = ‘www.sitetopostto.com’; // domain only, no path info
$path = ‘/path/to/program.cgi’; // path to cgi, asp, php program
$user_agent = ”; // identify as your own user agent (like ‘MSIE’) if you want
$fp = fsockopen($host, 80);
fputs($fp, “POST $path HTTP/1.1\r\n”);
fputs($fp, “Host: $host\r\n”);
fputs($fp, “Content-type: application/x-www-form-urlencoded\r\n”);
fputs($fp, “Content-length: ” . strlen($parameters) . “\r\n”);
if ($user_agent) {
fputs($fp, “User-Agent: $user_agent\r\n”);
}
fputs($fp, “Connection: close\r\n\r\n”);
fputs($fp, $parameters);
while (!feof($fp)) {
$data .= fgets($fp,128);
}
fclose($fp);
// (OPTIONALLY strip header returned (for XML response only), use $data otherwise
ereg(”<(.+)”,$data,$matched);
$without_header_data = ‘<’ . $matched[1];
?>