Hi,
I've written a script that logs onto a secured server and gets a file specified via the header. The file I'm getting should initiate and keep a browser session.
The goal is when I redirect from my webserver to the secure server people don't get the login box shown.
How can I create a script on the secure server that when executed, initiates a browser session.
This is the script that gets the file from the secure server:
<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
$login = base64_encode("user:pass");
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET /sessioncreator.php HTTP/1.1\r\n"; //this file is retrieved and executed
$out .= "Host: www.example/com\r\n";
$out .= "Connection: Close\r\n";
$out .= "Authorization: Basic " . $login . "\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
This is the script of the file retrieved on the secure server that doesn't initiate a session:
<?php
session_start();
$SESSION['user'] = $SERVER['PHP_AUTH_USER'];
$SESSION['p'] = $SERVER['PHP_AUTH_PW'];
$pw = $_SERVER['PHP_AUTH_PW'];
echo "Hi $pw.<P>";
?>
Any ideas?
Thanks