note 17727 deleted from ref.http by jimw
| From: | jimw@php.net | Date: | Fri, 21 Dec 2001 05:44:00 +0000 |
| Subject: | note 17727 deleted from ref.http by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23731@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)