PHP:使用基本身份验证从其他Web服务器下载文件吗?

PHP:使用基本身份验证从其他Web服务器下载文件吗?

问题描述:

我已经使用PHP已有一段时间了,但是我不太先进.我对服务器到服务器的东西没有太多经验.我需要研究与供应商建立数据Feed.我与之交谈的联系人说,我将通过基本身份验证使用用户名和密码从他们的服务器下载文件.有人可以给我介绍如何做吗?

I have been using PHP for a while but I am not too too advanced. I do not have much experience with server-to-server stuff. I need to research setting up a data-feed with a vendor. The contact person that I talked to said I would be downloading a file from their server using a username and password via basic authentication. Can someone please give me a break down on how to do that?

谢谢!

$f = fopen("http://$username:$password@example.com"); 

然后只使用与处理文件相同的方法,例如. fread,fgets,fclose等.

then just use the same methods as for manipulating files, eg. fread, fgets, fclose, etc.