$value) { $post .= $key.'='.$value.'&'; } // Put "get" variables back into string $get = ''; foreach ($_GET as $key => $value) { $get .= $key.'='.urlencode($value).'&'; } // Put other request headers back into array $headers = array(); $i = 0; foreach ($_SERVER as $k => $v) { if (substr($k, 0, 5) == "HTTP_") { $k = str_replace('_', ' ', substr($k, 5)); $k = str_replace(' ', '-', ucwords(strtolower($k))); $headers[$i++] = $k.': '.$v; } } $c = curl_init(); curl_setopt($c, CURLOPT_URL, "$websiteURL/cgi-bin/shop/index.pl?$get"); curl_setopt($c, CURLOPT_HEADER, true); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $post); curl_setopt($c, CURLOPT_HTTPHEADER, $headers); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $response = curl_exec ($c); curl_close ($c); list($header,$body) = explode("Content-Type: text/html", $response, 2); $headers = split("[\r\n]+", $header); foreach ($headers as $line) { if (!preg_match('/^Transfer-Encoding/', $line)) { if (preg_match('/^Set-Cookie/', $line)) { header($line, false); } else { header($line); } } } print substr($body, 4); function getHeaders() { return $headers; } ?>