RE: [PHP] fsockopen with apache auth
| From: | Cristian Draghici | Date: | Fri, 08 Sep 2000 14:03:07 +0000 |
| Subject: | RE: [PHP] fsockopen with apache auth | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15879@lists.php.net to get a copy of this message | ||
1. according to RFC1945 you should say "Authorization" and not
"Authentification".
2. The <Host> header comes in HTTP/1.1 and you declared 1.0.
3. you should send \r\n\r\n when you finish the request (in your example
apache never sees the authentification part cause after host you end the
headers)
Anyway, this works for me (Apache 1.3.12 on RedHat 6.2)
-----------
#telnet 0 80
GET /cristi/mail.php HTTP/1.0
Authorization: Basic Z2lnaTpSMG1hbjFhIw==
-----------
in your example I would do:
------
[..]
fputs($fp,"GET $path HTTP/1.0\r\nAuthorization: Basic
".base64_encode("username:userpw")."\r\n\r\n");
[..]
------
hope this helps
cristi