Basic Authentication

Hi guys,

I'm stuck! I have a need to "Authorization Basic".
I have the followining in my .htaccess file:
# Now try to fix the Authoriztion header problems
RewriteBase /
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1]

When I print out the $_SERVER variables I can see that HTTP_AUTHORIZATION is set, but is always empty.

I have sent the header via curl in two different ways each with the same result. I have tried:
curl_setopt($ch, USERPWD, $user.':'.$pass);

And I've also tried:
$headers[] = "Authorization: Basic ".base64_encode($user.':'.$pass);
$headers[] = "Content-Type: application/xml; charset=UTF-8";
$headers[] = "Accept: application/xml";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, true);

I have verified that $user and $pass are coming into the curl function correctly, I'm just not able to get it through Apache and into PHP.

Funny thing is that the same code works in another interface I have on the same server.... The RewriteRules even get $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] coming into the interface...

So I'm a bit perplexed....

Any insight you can offer?

Closed (fixed)