尽管提供了用户名和密码,仍无法验证cURL请求

时间:2019-07-08 08:36:26

标签: php apache http curl

我有一个开发URL,该URL使用简单的.htpasswd文件进行HTTP身份验证-完全没有特殊要求。

我正在尝试通过cURL击中该域上的URL,但我当然会收到此消息:

Unauthorized
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Apache/2.4.29 (Ubuntu) Server

我添加了我认为是授权url的正确参数,但并不高兴。相同的消息。我已经回显了用户名和密码,它们与我在浏览器提示中输入的完全相同。

enter image description here

下一步要进行调试吗?

1 个答案:

答案 0 :(得分:0)

我通过不使用curl_setopt_array来解决此问题,而是分别设置每个3个。目前无法解释为什么这有所不同,但是可以正常工作! :(

enter image description here

相关问题