Posting A Form Directly From PHP To Multiple Locations

PHP Code
function post($host, $path, $data) {

$http_response = '';

// We have to know how long the POST is
$content_length = strlen($data);

$fp = fsockopen($host, 80); //connect to host domain, port 80

// HTTP Headers
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-Type: application/x-www-form-rlencoded\r\n");
fputs($fp, "Content-Length: $content_length\r\n");
fputs($fp, "Connection: close\r\n\r\n");

// Make the POST
fputs($fp, $data);
while (!feof($fp)) $http_response .= fgets($fp, 28);

fclose($fp);
return $http_response;

}

$postdata = '?foo=bar';
foreach($_POST as $key => $val) $postdata .= '&'.$key.'='.$val;

$http_response = post('example.org', '/path/to/script.php', $postdata);
?> 



The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)