PHP as a proxy to an htaccess protected site. (STILL UNRESOLVED)
| From: | php at net dot co dot cr | Date: | Mon, 24 Jun 2002 15:33:15 +0000 |
| Subject: | PHP as a proxy to an htaccess protected site. (STILL UNRESOLVED) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-103610@lists.php.net to get a copy of this message | ||
Hi people,
Iam trying to make a script that you give it the login and password for
a determined password protected site, and it logs you in. It will be
like a proxy.
So, what I have is something like this:
<?
$fp = fopen ("http://
$login:$password@domain.net/protected_area/index.html", "r");
while (!feof ($fp)) {
$buffer = fgets($fp, 4096);
echo $buffer;
}
fclose ($fp);
?>
So now.. here I have two problems:
1.) If the user enters a login/pass that is not the correct this
appears on the screen hundreds of times:
"Warning: Supplied argument is not a valid File-Handle resource .."
2.) /protected_area/index.html is a frame site, which means that if the
pass/login are ok it will show you only the index.html, but this is
made of frames, so then I have another login prompt for the frames.
My question is, is there anyway I can fix problem 1, and in problem 2
is there anyway to proxy this in a better way, where you input the
login once and it stay there so i dont get any more login prompts?
Thank You.