PHP 标头信息

发布于 2024-12-26 17:17:16 字数 110 浏览 0 评论 0原文

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

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

I am a PHP developer. i am facing a problem on getting "Authorization variables" set by the user in request sent by using CURL.

I am not able to get these variables set by the user during curl request in my php code. Please help thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一人独醉 2025-01-02 17:17:16

您要查找的值可能在 $_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< /a>

It's possible that the values you are looking for are in the $_SERVER variables?

From 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. 

You should be able to access these variables like this:

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

This will give you an idea of how to handle the different digests: http://php.net/manual/en/features.http-auth.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文