soo*_*soo 3 php http basic-authentication
我想使用php以编程方式下载文件(例如http://rapidpich.ir/d/555864).但是,当我尝试在我的网络浏览器中关注链接时,我被要求输入用户名和密码.
如何在PHP中提供这些凭据并检索文件?

通常要抓住你写的文件,如:
$file_contents = file_get_contents("http://url.to/file");
Run Code Online (Sandbox Code Playgroud)
您可以执行除存储到变量之外的操作,也可以使用其他功能.
如果文件受HTTP身份验证保护,您通常可以在URI中指定凭据:
$file_contents = file_get_contents("http://username:password@url.to/file");
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助.