"';
$content = str_replace("", $proxiedUrlTag, $content);
// change form method to GET
$content = str_replace('method="POST"', 'method="GET"', $content);
// actual replacements
foreach ($replacements as $k => $v) {
$content = str_replace($k, $v, $content);
}
// print
echo $content;
function httpRequest($url, $data, $method = "GET", $referer='') {
$url = parse_url($url);
$host = $url['host'];
$path = $url['path'];
$query = $url['query'];
$method = strtoupper($method);
$fp = fsockopen($host, 80, $errno, $errstr, 60);
if ($fp){
fputs($fp, "$method http://$host$path?$query HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
if ($referer != '') fputs($fp, "Referer: $referer\r\n");
if ($method == 'POST') fputs($fp, "Content-length: ". strlen($data) ."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST') fputs($fp, $data);
$result = '';
while(!feof($fp)) {
// receive the results of the request
$result .= fgets($fp, 128);
}
} else {
die("$errstr ($errno)");
}
fclose($fp);
$result = explode("\r\n\r\n", $result, 2);
$header = isset($result[0]) ? $result[0] : '';
$content = isset($result[1]) ? $result[1] : '';
return array(
'status' => 'ok',
'header' => $header,
'content' => $content
);
}
?>