Hi,
I'm making a little portal that allows me to access sites through my site, now Everyhting works great the only thing im having problems with is the header being sent by the server. Is there a way to not show this?
Right now im filtering the headers but I cannot get them all
Filters
//Slashdot Stuff
$getdata = eregi_replace("HTTP/1.1 200 OK", "", $getdata);
$getdata = eregi_replace("Cache-Control: private", "", $getdata);
$getdata = eregi_replace("Pragma: private", "", $getdata);
$getdata = eregi_replace("Vary: User-Agent,Accept-Encoding", "", $getdata);
$getdata = eregi_replace("Connection: close", "", $getdata);
$getdata = eregi_replace("Transfer-Encoding: chunked", "", $getdata);
$getdata = eregi_replace("Content-Type: text/html; charset=iso-8859-1", "", $getdata);
$getdata = eregi_replace("Server: Apache/1.3.33 (Unix) mod_gzip/1.3.26.1a mod_perl/1.29", "", $getdata);
$getdata = eregi_replace("SLASH_LOG_DATA: shtml", "", $getdata);
$getdata = eregi_replace("X-Powered-By: Slash 2.005000", "", $getdata);
$getdata = eregi_replace("e5a", "", $getdata);
//CNN Stuff
$getdata = eregi_replace("Server: Apache", "", $getdata);
$getdata = eregi_replace("Content-Type: text/html", "", $getdata);
$getdata = eregi_replace("Cache-Control: max-age=60, private", "", $getdata);
$getdata = eregi_replace("Vary: Accept-Encoding,User-Agent", "", $getdata);
$getdata = eregi_replace("Content-Length: 61153", "", $getdata);
//MISC
$getdata = eregi_replace("X-Powered-By: PHP/4.3.10", "", $getdata);
$getdata = eregi_replace("mod_ssl/2.8.16", "", $getdata);
$getdata = eregi_replace("OpenSSL/0.9.6b PHP/4.3.10 e70", "", $getdata);
$getdata = eregi_replace("Accept-Ranges: bytes", "", $getdata);
$getdata = eregi_replace("Keep-Alive: timeout=15, max=996", "", $getdata);
$getdata = eregi_replace("Connection: Keep-Alive", "", $getdata);
//MSN
$getdata = eregi_replace("X-Powered-By: ASP.NET", "", $getdata);
$getdata = eregi_replace("X-AspNet-Version: 1.1.4322", "", $getdata);
$getdata = eregi_replace("Cache-Control: no-cache", "", $getdata);
$getdata = eregi_replace("Pragma: no-cache", "", $getdata);
$getdata = eregi_replace("Expires: -1", "", $getdata);
$getdata = eregi_replace("Content-Length: 29258", "", $getdata);
$getdata = eregi_replace("Server: Microsoft-IIS/5.0", "", $getdata);
$getdata = eregi_replace('P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"', "", $getdata);
$getdata = eregi_replace('Server: Microsoft-IIS/6.0', "", $getdata);
$getdata = eregi_replace('; charset=utf-8', "", $getdata);
$getdata = eregi_replace('Content-Length: 29245', "", $getdata);
here some header info, from when I goto www.msn.com.
On top of the page I get this...
Thu, 31 Mar 2005 10:37:55 EST Date: Thu, 31 Mar 2005 15:37:57 GMT Set-Cookie: mh=MSFT; domain=.msn.com; expires=Tue, 31-Mar-2015 15:37:58 GMT; path=/ Set-Cookie: MSNADS=UM=; domain=.msn.com; expires=Tue, 26-Apr-2022 19:00:00 GMT; path=/ Set-Cookie: SPEED=N; domain=.msn.com; expires=Thu, 14-Apr-2005 14:37:58 GMT; path=/ Content-Length: 29257
Im using PHP fsockopen
My main Function
function fetchURL( $url ) {
$url_parsed = parse_url($url);
$host = $url_parsed["host"];
$port = $url_parsed["port"];
if ($port==0)
$port = 80;
$path = $url_parsed["path"];
//if url is [url]http://example.com[/url] without final "/"
//I was getting a 400 error
if (empty($path))
$path="/";
//redirection if url is in wrong format
if (empty($host)):
$host="www.daemonprojects.com";
$path="/404.php";
endif;
if ($url_parsed["query"] != "")
$path .= "?".$url_parsed["query"];
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: ".$host."\r\n";
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
$out .= "User-Agent: mozilla Portal\r\n";
$out .= "Connection: Close\r\n\r\n";
$fp = fsockopen($host, $port, $errno, $errstr, 30);
fwrite($fp, $out);
while (!feof($fp)) {
//filter
$getdata = fgets($fp, 128);
//Slashdot Stuff
$getdata = eregi_replace("HTTP/1.1 200 OK", "", $getdata);
$getdata = eregi_replace("Cache-Control: private", "", $getdata);
$getdata = eregi_replace("Pragma: private", "", $getdata);
$getdata = eregi_replace("Vary: User-Agent,Accept-Encoding", "", $getdata);
$getdata = eregi_replace("Connection: close", "", $getdata);
$getdata = eregi_replace("Transfer-Encoding: chunked", "", $getdata);
$getdata = eregi_replace("Content-Type: text/html; charset=iso-8859-1", "", $getdata);
$getdata = eregi_replace("Server: Apache/1.3.33 (Unix) mod_gzip/1.3.26.1a mod_perl/1.29", "", $getdata);
$getdata = eregi_replace("SLASH_LOG_DATA: shtml", "", $getdata);
$getdata = eregi_replace("X-Powered-By: Slash 2.005000", "", $getdata);
$getdata = eregi_replace("e5a", "", $getdata);
//CNN Stuff
$getdata = eregi_replace("Server: Apache", "", $getdata);
$getdata = eregi_replace("Content-Type: text/html", "", $getdata);
$getdata = eregi_replace("Cache-Control: max-age=60, private", "", $getdata);
$getdata = eregi_replace("Vary: Accept-Encoding,User-Agent", "", $getdata);
$getdata = eregi_replace("Content-Length: 61153", "", $getdata);
//MISC
$getdata = eregi_replace("X-Powered-By: PHP/4.3.10", "", $getdata);
$getdata = eregi_replace("mod_ssl/2.8.16", "", $getdata);
$getdata = eregi_replace("OpenSSL/0.9.6b PHP/4.3.10 e70", "", $getdata);
$getdata = eregi_replace("Accept-Ranges: bytes", "", $getdata);
$getdata = eregi_replace("Keep-Alive: timeout=15, max=996", "", $getdata);
$getdata = eregi_replace("Connection: Keep-Alive", "", $getdata);
//MSN
$getdata = eregi_replace("X-Powered-By: ASP.NET", "", $getdata);
$getdata = eregi_replace("X-AspNet-Version: 1.1.4322", "", $getdata);
$getdata = eregi_replace("Cache-Control: no-cache", "", $getdata);
$getdata = eregi_replace("Pragma: no-cache", "", $getdata);
$getdata = eregi_replace("Expires: -1", "", $getdata);
$getdata = eregi_replace("Content-Length: 29258", "", $getdata);
$getdata = eregi_replace("Server: Microsoft-IIS/5.0", "", $getdata);
$getdata = eregi_replace('P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"', "", $getdata);
$getdata = eregi_replace('Server: Microsoft-IIS/6.0', "", $getdata);
$getdata = eregi_replace('; charset=utf-8', "", $getdata);
$getdata = eregi_replace('Content-Length: 29245', "", $getdata);
echo $getdata;
}
fclose($fp);
return $in;
}