cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Retrieving the authenticated username:password from server with PHP

From: Christopher Vrooman <cdvrooman_at_gmail.com>
Date: Tue, 18 Mar 2008 09:03:00 -0300

simon wrote:
> Christopher Vrooman wrote:
> > I would assume they would show up in $_SERVER['PHP_AUTH_USER'] &
> > $_SERVER['PHP_AUTH_PW'], but those two variables have never, ever
> > appeared for me.
> >
> I can confirm that these variables do indeed work, and are set in PHP
> when a user is authenticated by simple http auth - I was working with a
> project using these yesterday.
>

Simon, thanks for the quick reply.

Maybe I wasn't clear about what I want to do.

I'm trying to create a PHP5 REST based chat client a lá Twitter (only
not with millions of users). So I want to be able to authenticate a
user who logs into my website "normally" i.e. not with a basic realm
dialogue box, rather just a vanilla login, because the chat will be an
"extra" for another site, so the login to the chat should be
secondary, perhaps with a different username/pw I'll pull from a
database (so no Basic Auth).

So are you saying that if I use:

     curl_setopt($curl_handle, CURLOPT_USERPWD, "username:password");

Then that should *automatically* create the $_SERVER[PHP_AUTH_*] entries?

If so, I'm in trouble because I tried every curl_setopt($ch,
CURLOPT_HTTPAUTH, CURLAUTH_ANY); setting I could find, and the elusive
PHP_AUTH_* never appeared in $GLOBALS.

What is more... a Twitter API class I found by Nick Beam, doesn't even
set CURLOPT_HTTPAUTH at all, yet it works with their server :(

So, maybe if the problem is my server, you could give me a hint as to
how to determine what my server needs me to specify to get things
working?

Sincerely,
      Christopher.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-03-18