Re: Problems with mirror site script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you're looking to build an web based proxy that supports ads, there's already tons of scripts out there that do it securely, and render very nicely. Most even supporting ad management.

CGIProxy http://www.jmarshall.com/tools/cgiproxy/
PHProxy http://whitefyre.com/poxy/
Zelune http://www.zelune.net/

Are some of the extremly popular ones.  No need to reinvent the wheel.

- Dan

""Wikus Möller"" <wikus.m@xxxxxxxxx> wrote in message news:723b2ee70706261719k2de4f038t7094fa36a2c372f7@xxxxxxxxxxxxxxxxx
Hi.

I am currently writing a script to put on my site so people can browse
other sites by using my site as a mirror therefore the contents of a
webpage would be retrieved and echoed on my site.

I am having some problems with placing my ad at the top of the page
that is echoed when a user browses a site so that it doesn't interfere
with the headers. I am having problems with where to place the link
e.g. after the body tag, and how to find out what type of page it is
i.e. html, xhtml, etc. so I know if I can use specific effects with my
ads.

Also, when a user clicks on a link on the mirrored page the link
should be mysite.com/index.php?go=http://othersite.com/othersitepage.htm
and not mysite.com/othersitepage.htm

I have tried to use str_replace in the contents of the retrieved
webpage but it doesn't seam to work.

Here is the simple piece of code that I have started with without security etc:

<?

////// $http is the page that the user wants to browse

$handle = fopen($http, "r");   ///////////get contents of webpage
$contents = fread($handle, 500000);
fclose($handle);

$replace = explode("mysite.com/", $contents);
str_replace("mysite.com",
"mysite.com/index.php?http=$http/$replace[1]", $contents);

if(strstr($contents, "<!DOCTYPE html
    PUBLIC \"-//W3C//DTD HTML"))
{
$ads = ads_html();
$contents2 = explode("</body>" , $contents);
}

if(strstr($contents, "<!DOCTYPE html
    PUBLIC \"-//W3C//DTD XHTML"))
{
$ads = ads_xhtml();
$contents2 = explode("</body>" , $contents);
}


echo $contents2[0] . $ads . $contents2[1];
?>

Please advise me if there is another better way to place my ad and
check the type of page because this coding is just wrong and
error-prone.

Thanks
Wikus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux