fsockopen with apache auth
| From: | bill | Date: | Fri, 08 Sep 2000 13:33:48 +0000 |
| Subject: | fsockopen with apache auth | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15875@lists.php.net to get a copy of this message | ||
I'm still stuck with fsockopen on an apache password-protected
directory.
Does it make a difference if I'm calling a non-standard port?
Here's the code:
function GetFromHost($host,$path) {
$fp = fsockopen($host,911);
set_socket_blocking($fp, true);
fputs($fp,"GET $path HTTP/1.0\r\nHost: $host\r\n\r\nAuthentication:
Basic ".base64_encode("username:userpw")."\r\n\r\n");
while(!feof($fp)){
echo fgets($fp,1024);
}
fclose($fp);
}
I keep getting a 401 Not-Authorized error.
I appreciate any help.
kind regards,
bill