Lol sorry if that wasn't too clear, thanks to all bearing with me 😛
What I want to do is combine the username which is inputted through the form on my server, with a hidden field containing @domain. This combination, let's call it "login" is then posted together with the password and some other variables to the server running the webmail app as such:
$fp = fsockopen($host, 80 );
if ( $fp )
{
// send headers to target server
fwrite($fp, "POST $path HTTP/1.1\n");
fwrite($fp, "Host: $host\n");
fwrite($fp, "Content-Length: $qlen\n");
fwrite($fp, "Content-Type: application/x-www-form-urlencoded\n");
fwrite($fp, "Connection: Close\n");
fwrite($fp, "\n");
fwrite($fp, "$query\n");
Now to actually complete the process and get logged in, I then catch the servers response using the following:
while( !feof($fp) )
{
$response .= fgets($fp, 4096);
}
fclose($fp);
Which returns the following headers (sorry for the lack of newlines, wasn't that far yet with the code lol):
HTTP/1.1 302 Found Date: Tue, 31 Dec 2002 07:43:18 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_jk/1.2.0 mod_perl/1.24_01 PHP/4.2.2 FrontPage/5.0.2 mod_ssl/2.8.12 OpenSSL/0.9.6b X-Powered-By: PHP/4.2.2 Pragma: no-cache Set-Cookie: SQMSESSID=7d9c8672647c84ad9e5a03bd9413a600; path=/squirrelmail/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Set-Cookie: squirrelmail_language=en_US; expires=Thu, 30-Jan-03 07:43:18 GMT; path=/squirrelmail/ Set-Cookie: key=JU684lVjNXk%3D; path=/squirrelmail/ Location: webmail.php Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 0
This redirects my browser to webmail.php on my server (the one running the script I'm writing, not the one running the webmail app), while I was hoping for it to get me logged in to the webmail. Hence problem 🙂 Anyone? Pretty please? 🙂