I've created a script to retrieve files from another server. The script is run on Server A and the files reside on Server B, but I've just found out that when using the script on server A both get hit with the bandwidth. Its as though the file is being opened on Server B, transfered to Server A then sent to the user instead of opening a direct link from the user via the script on Server A to the file on Server B.
Lost yet? Anyone have a clue why this is happening? For reference sake here is a snippit of the code I'm using... perhaps it needs to be changed:
<?php
// set variables here
// $file
// $filename
// $size
// end setting variables
header("Content-Type: application/whatever");
header("Content-Disposition: attachment; filename=$filename");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . $size . "\n");
$fp=fopen($file, "r");
fpassthru($fp);
?>