HI,..maybe I find someone here with a clue about this:
I have a script where I need to fetch some arrays and send them to remote server web form with browser emulation; done like this:
function PostToHost($host, $path, $data_to_send)
{
$fp = fsockopen($host, 80);
fputs($fp, "POST $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, $data_to_send);
/
while(!feof($fp))
{
echo fgets($fp, 128);
}
/
fclose($fp);
}
WHERE
$host is the server to connect to (www.someserver.com)
$path is the file path of the script (/somdir/somescript.asp)
$data_to_send is the post data string like:
(field1=data&field2=data&field3=data)
Everything goes fine and this is working BUT in real life I need to login to this remote server.
Where and how do I put my username and password into this code so the remote server will accept connection and parse all data sent????
I need http Authentication not script or sql Auth..
In simple words: I would like to Auto login and bypass popup window requesting username and password.