如何使用 PHP 从密码区域获取文件

发布于 2024-08-25 14:30:16 字数 102 浏览 5 评论 0原文

我想制作一个脚本,该脚本采用文件的 URL 并将该文件导入到我的 Web 服务器中的特定文件夹 如果文件位于密码区域,如何请求文件,我有一个帐户“用户名/密码”,但我如何向该文件发出请求?

I want to make a script that takes a URL to a file and will import that file to a specific folder in my web server
how to request a file if it's in a passworded area, i have an account "username/password" but how can i make the request to that file ?

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

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

发布评论

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

评论(2

随遇而安 2024-09-01 14:30:16

这取决于用于执行身份验证的机制。它可能是一个发出 cookie 的基于成形的系统(在这种情况下,您需要向 auth URI 发出请求并存储返回的 cookie),它可能是 HTTP 基本身份验证(在这种情况下使用 CURLOPT_USERPWD)。

It depends on the mechanism used to perform the authentication. It might be a formed based system that issues a cookie (in which case you need to make a request to the auth URI and store the returned cookie), it might be HTTP basic authentication (in which case use CURLOPT_USERPWD).

青柠芒果 2024-09-01 14:30:16

如果是 HTTP 授权,您可以这样访问它:

http://username: [电子邮件受保护]/folder/myfile.jpg

If it is HTTP Authorization you can access it like that:

http://username:[email protected]/folder/myfile.jpg

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