Are you sure you want to send an external POST request to a PHP script on
the same server? That doesn't make a whole lot of sense to me. Why not
simply include file1_1.php4 directly from file_1.php4.
However, assuming you have some logical reason for wanting to do this, it
is rather simple. In your POST request just add another header. The
header looks like this:
Authorization: Basic Zm9vOmJhcg==
So just fputs() this after your POST.
The format of Basic auth is amazingly simplistic. Try a
base64_decode('Zm9vOmJhcg==')
and you will see that it turns into:
foo:bar
ie. just username:password. So you would most likely want something like:
fputs($sock, 'Authorization: ' . base64_encode("$user:$pass") . "\r\n");
-Rasmus
On Thu, 13 Dec 2001, Silvia Mahiques wrote:
> Hi Friends!:
> I have some problems with APACHE Authenticate. I have a directory with
> access control. This is his structure:
>
> <intranet_directory>
> file_1.php4
> ...
> <people_directory>
> file1_1.php4
> ...
> <research_directory>
> <publications_directory>
> ...
>
> The problem is that I can't access to file1_1.php4 that is call from
> file_1.php4 with a POST method. This POST method is make without user
> interaction, is call internaly by script file_1.php4. All is Ok when I
> access file_1.php4, but when I try to access file1_1.php4 the server sends
> this message:
>
>
> HTTP/1.1 401 Authorization Required Date: Wed, 12 Dec 2001 18:45:16 GMT
> Server: Apache/1.3.20 (Win32) PHP/4.0.6 WWW-Authenticate: Basic
> realm="Restricted GTC member Directory" Connection: close Content-Type:
> text/html; charset=iso-8859-1
> Authorization Required
> This server could not verify that you are authorized to access the document
> requested. Either you supplied the wrong credentials (e.g., bad password),
> or your browser doesn't understand how to supply the credentials required.
>
>
>
> I think that I have to pass to the server the information about Authenticate
> (type of Authenticate, user, password) when I make a POST internaly, because
> this work is make normaly by browser and perhaps I have to do now. But, how
> can I make this?
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]