Some of us live in countries where these proxy servers are banned.
I cannot access anonymiser, safesurf or any of the other open proxies.
sometimes accessing cnn is useful, so I wrote some quick and very nasty code
to retrieve and view webpages - also encrypts the url as well - China
sometimes bans via url contents, so www.someserver.com/proxy/www.cnn.com
would be banned as well.
(Chinese Government went through a phase a few weeks ago where even google
was banned, that was terrible, I rely on google every day!).
See code below (it's not good, but it works - text only)
I use it on my Shanghai site www.shanghaiguide.com in the proxy page -
www.shanghaiguide.com/proxy
<?php
function ROT ($string,$n=13){
for ($i = 0; $i < strlen($string); $i++) {
$string[$i] = chr(ord($string[$i]) + $n);
}
return $string;
}
if (!isset($URL)) {
?>
<form action="<?php print $PHP_SELF;?>" method=post>
<input name="URL" size=50 value="">
<p><input type=submit value="Go">
</form>
<br>
No Graphics will be displayed, only a href style links are processed, proxy
is alpha version, but hey its better than nothing<br>
<?php
}
else {
if (isset($ENC)) {
$URL =ROT ($URL,-1);
}
//Check prefix badly
if (substr (strtoupper($URL),0,4) == "HTTP") {
//Probly http
}
else {
$URL="http://".$URL;
}
if (isset($URLPATH)){
if (strpos ($URLPATH,"p://")) {
$URL="";
//New Site = strip out the http:// and replace
//To Do
if (substr($URLPATH,-3)=='gif') {
Header("Content-type: image/gif");
}
if (substr($URLPATH,-3)=='jpg') {
Header("Content-type: image/jpg");
}
}
//If url ends in / and urlpath starts in / strip url
trailing slash.
if ((substr($URL,-1) =="/" ) && (substr($URLPATH,0,1)=="/"))
{
$URL=substr ($URL,0,strlen($URL)-1);
}
}
else {
$URLPATH="";
if (substr($URL,-1) !="/"){
$URL.="/";
}
}
//$URL =ROT($URL,1);
//print "Encrypted URL=". $URL;
if (!$NOHDR) {
print "URL =".$URL;
//Show Browse Form Again
?>
<form action="<?php print $PHP_SELF;?>" method=post>
<input name="URL" size=50 value="<?php print $URL;?>">
<input type=submit value="Go">
</form>
<hr>
<?php
}
@$up = fopen($URL.$URLPATH,"r");
if ($up){
while (!feof($up)) {
$results.= fread($up, 1024);
}
fclose($up);
unset($URLPATH);
}
$URL=ROT($URL,1);
//$results = str_replace("href=\"http://", "href=" $scriptpath "?url="$url,
$pagedata);
$results = eregi_replace ("href=\"" ,
"href=\"$PHP_SELF?ENC=1&URL=$URL&URLPATH=",$results);
$results = eregi_replace
("src=\"","src=\"blank.gif?$PHP_SELF?ENC=1&NOHDR=1&URL=$URL&URLPATH=",$resul
ts);
print $results;
}
?>
There are better ways to do this, James Marshall wrote CGIProxy, but this is
the only one I know that also encrypts urls.
-----Original Message-----
From: Dan Harrington [mailto:[EMAIL PROTECTED]]
Sent: August 29, 2001 8:52 AM
To: daniel james; Jeff Lewis; [EMAIL PROTECTED]
Subject: RE: [PHP] Pulling webpages - may be a weird question :)
http://www.anonymiser.com
> -----Original Message-----
> From: daniel james [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 28, 2001 12:23 PM
> To: Jeff Lewis; [EMAIL PROTECTED]
> Subject: Re: [PHP] Pulling webpages - may be a weird question :)
>
>
> try readfile('http://www.somesite.com/');
>
> it creates a mirror; it might bypass the firewall,
> depending on how the blocking software is keyed to
> activate.
>
> -dj
> --- Jeff Lewis <[EMAIL PROTECTED]> wrote:
> > I was sitting here at work (working of course!)
> > thinking about how some sites are blocked etc from
> > viewing... Is it possible with PHP to do something
> > like this:
> >
> > Have a page where I can create kind of a middle man.
> > I mean the PHP can be hosted on my server, it goes
> > to the site I'd want to view (lets say www.php.net).
> > It then relays it to my browser but as if it is
> > coming from my server. So can it grab the pages,
> > temp write them and server them over to me?
> >
> > I know it seems kind of strange but I am curious
> > about it....
> >
> > Jeff
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]