mcguile25
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by mcguile25
-
-
Hi, I am trying to be able to write a PHP script that will connect to an external site that has a restricted directory (htaccess) that I want to redirect the user to. Obviously I have to send over the username and password in the headers. I have everything working, but what's happening is all I am getting back is the HTML for the index file in the folder in question from the server...but I want to literally redirect the user to that external site after I've been authenticated...how is that possible? Here is my code:
[code]
$fp = fsockopen( $host, 80, $errno, $errstr );
$auth = base64_encode( "$username:$password" );
$out = "GET $path HTTP/1.0\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Keep-Alive\r\n";
$out .= "Authorization: Basic $auth\r\n";
$out .= "\r\n";
fputs( $fp, $out );
$response = "";
while ( !feof( $fp ) )
{
$response .= fgets( $fp, 4096 );
}
fclose( $fp );
[/code] -
Hi, what I want to do is have a PHP script on my server be able to send a username and password to a web form on a different server. First of all, is this possible? Can I just send a POST request to the "action" of the web form with the username and password variables? Or is a bit more complicated?
Thanks.
Logging into a remote site (htaccess) using fsockopen
in PHP Coding Help
Posted
Is the only way to do this is by using the http://username:password@url scheme?
By doing this, all of the links show the username and password in the status bar as I am highlighting the links.
Is there any other way??