Re: Send username & password in HTTP headers
| From: | Chris Shiflett | Date: | Wed, 12 May 2004 15:55:55 +0000 |
| Subject: | Re: Send username & password in HTTP headers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186000@lists.php.net to get a copy of this message | ||
--- Nagendra Prasad <nthumuluru@osi-tech.com> wrote:
> I'm posting some XML data to my client's website using HTTP Post.
> Assume I'm posting to getxml.php (hosted on my clients server).
> Now my client has put authentication on his website using
> header('WWW-Authenticate: Basic realm="Private Area"');
>
> Now the page getxml.php asks me to prove my identity before it
> acceps my xml posts. So how do I send the username & pwd when I'm
> posting the xml details?
Include an Authorization header, which should look something like this:
Authorization: Basic bXluYW1lOm15cGFzcw==
The encoded string is just the result of this:
base64_encode('myname:mypass')
Substitute with the correct username and password.
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/