2

I have a problem mentioned below:

There will be multiple servers like a.com, b.com, b1.com and so on. The user will always logon to a.com and request for a file which would be present on any of the b.com, b1.com etc server. All fiels are present on servers with names starting from "b".

The application will connect to b1.com and find the file. Now I want a way to download the file from b1.com without the user knowing that it is actually coming from b1.com. Is there a way that the file can be directly downloaded from b server to user desktop/pc? Or is there any way that while the file is being downloaded from "b" to "a", I can start the file transfer from "a" to "user"

I dont want to first downlaod the complete file from b to a and then a to user as it will double up the transfer time which will impact performance when file is large.

Any solutions in mind for this?? I am using PHP on server side. Any other solution is also welcome.

4

1 回答 1

1

使用fsockopenfopen连接到您的 b 服务器,向您的客户端发送标头以指示文件类型以触发下载,然后在循环中使用 每次下载 8 KB 文件fread,并使用输出缓冲( ob_flush()) 将 8 KB 刷新到用户,并迭代直到文件完成下载。

或者

为了避免这一切,您可以考虑使用 Apache 的mod_proxy模块。

于 2012-05-31T07:49:22.650 回答