note 17727 added to ref.http
| From: | Peter dot Warasin at darkrealms dot org | Date: | Fri, 21 Dec 2001 04:46:18 +0000 |
| Subject: | note 17727 added to ref.http | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-23730@lists.php.net to get a copy of this message | ||
If you want to request htaccess secured document try this code:
$uri = "/blah/iampasswordsecured.html";
$host = "i.am.htaccess.capable.webserver.org";
$user = "Aladdin";
$password = "open sesame";
$basiccredentials = base64_encode($user . ":" . $password);
$sp = fsockopen($host, 80, $errnr, $errstr, 30);
if (! $sp) {
print "$errstr ($errnr)<BR>\n";
} else {
fputs($sp, "GET $uri HTTP/1.1\r\nHost: $host\r\nAuthorization: Basic
$basiccredentials\r\n\r\n");
while (!feof($sp)) {
print fgets($sp, 128);
}
fclose($sp);
}
this works like virtual() ;-)
note: this is the basic access authentication scheme only. if you want to use the digest
authentication scheme implement it yourself ;) using the rfc2617 (page 6)
--
http://www.php.net/manual/en/ref.http.php
http://master.php.net/manage/user-notes.php?action=edit+17727
http://master.php.net/manage/user-notes.php?action=delete+17727
http://master.php.net/manage/user-notes.php?action=reject+17727