jeg er ikke helt sikker på om det er det du vil, men følgende script tager alle POST-variable, sender dem til scriptet '
http://www.etellerandet.dk/etellerandet.cgi' og viser resultatet til brugeren. (akkurat som hvis han selv havde gået ind på den side) :
<?php
function sendToHost($host,$method,$path,$data,$useragent=0)
{
// Supply a default method of GET if the one passed was empty
if (empty($method))
$method = 'GET';
$method = strtoupper($method);
$fp = fsockopen($host,80);
if ($method == 'GET')
$path .= '?' . $data;
fputs($fp, "$method $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($data) . "\r\n");
if ($useragent)
fputs($fp, "User-Agent: MSIE\r\n");
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST')
fputs($fp, $data);
while (!feof($fp))
$buf .= fgets($fp,128);
fclose($fp);
return $buf;
}
function splitHttp($http)
{
if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $http, $match)) {
return array('header' => $match[1], 'body' => $match[2]);
} else return array('header' => $http, 'body' => null);
}
$flag = true; $data = '';
foreach ($HTTP_POST_VARS as $key => $value) {
if ($flag) $flag = false;
else $data .= '&'
$data .= $key.'='.rawurlencode($value);
}
$http = sendToHost('
www.etellerandet.dk','POST','
http://www.etellerandet.dk/etellerandet.cgi',$data);
$match = splitHttp($http);
foreach ($match['header'] as $header)
header($header);
if ($match['body'] != null)
echo $match['body'];
exit;
?>