user and password for socket connection
| From: | Wilbert Enserink | Date: | Thu, 12 Sep 2002 09:02:05 +0000 |
| Subject: | user and password for socket connection | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116114@lists.php.net to get a copy of this message | ||
Hi all,
I'm trying to open a socket connection on a client. The server needs a username/password
combination for this connection to accept. Does anybody know how to send this with php??
In ASP I use ................
"xmlhttp.Open "POST",sURL, false, sUser, sPass"
,where sUser=myUsername and sPass=myPassword. this script worx, but of course I want to use PHP :-)
in php i'm trying.........
$hostname="https://www.url.com";
$port=443;
$loginmessage="GET / HTTP/1.0\r\nHost: www.php.net\r\n\r\n";
$timeout=30;
$fp = fsockopen ($hostname, $port, $errno, $errstr, $timeout);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, $loginmessage);
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
thx Wilbert
-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
info@pdd.nl
-------------------------