PHP标题信息

PHP标题信息

问题描述:

我是一名PHP开发人员。我在使用CURL发送的请求中获取用户设置的“授权变量”时遇到问题。PHP标题信息

我无法在我的php代码中获得curl请求期间由用户设置的这些变量。请提前帮助感谢。

+0

你打算怎么做?请在代码方面发布您迄今为止所获得的结果。 – 2012-01-11 07:49:33

您正在查找的值可能位于$ _SERVER变量中?

http://www.php.net/manual/en/reserved.variables.server.php

'PHP_AUTH_DIGEST' 
When doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation). 

'PHP_AUTH_USER' 
When doing HTTP authentication this variable is set to the username provided by the user. 

'PHP_AUTH_PW' 
When doing HTTP authentication this variable is set to the password provided by the user. 

'AUTH_TYPE' 
When doing HTTP authenticated this variable is set to the authentication type. 

您应该能够像这样访问这些变量:

$username = $_SERVER['PHP_AUTH_USER']; 
$password = $_SERVER['PHP_AUTH_PW']; 

这会给你的如何处理不同的消化一个想法:http://php.net/manual/en/features.http-auth.php