从另一台服务器下载文件的旁路服务器php代码

My situation is illustrated in the figure below:

I have a file X on the main server A which I want to download from my local computer B and the file X is downloadable through HTTP. But, for some reason I am not allowed to download file from the main server A. However, I have an access to another server C which has PHP installed. I now want to download the file X via the server C by calling some PHP script on server C from my local computer B.

Is it possible to write one PHP script to do the above?

Any help in writing so will be highly appreciated.

I'm not completely sure of what you need but you can use the following script to act as proxy between 2 servers.

PUT THIS FILE ON SERVER C

phpProxy.php

<?php
$myPass = "Secr3t";
if( $myPass == $_GET['pass'] ){
    $remoteFile = $_GET['rf'];
    $filename = basename( $remoteFile );
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"$filename\"");
    echo file_get_contents( $remoteFile );
}

USE AS:

phpProxy.php?rf=http://phs.googlecode.com/files/Download%20File%20Test.zip&pass=Secr3t

NOTES:
1 - I've added a password otherwise the script is very unsafe!
2 - If possible, use https to avoid MITM