Here's my case: I have a file on a server (e.g www.server1.com/file.rar). I want send this file to my client. But, the www.server1.com accept connections from only one IP. I have a lot of clients, so I have a lot of IP's.
The solution could be transfer the file from www.server1.com to www.server2.com (which has one IP address only) and provide the file: www.server2.com/file.rar But... In this case I need transfer the file from server1 to server2, and that's (bandwidth and space).
There's any alternatives for that? I was thinking about something like:
header("Content-Disposition: attachment; filename=" . urlencode($file));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
file_get_contents("http://server1.com/file.rar");
But didn't work as expected.
Thanks in advance
Edit: I can't reply my own question cause I'm new user... Well, i want say thanks to Everyone for the replys, they send me to the solution. Which is: file_get_contents didn't work because of server flush, so I used fopen and fread with ob_flush and flush
header("Content-Disposition: attachment; filename=" . urlencode($arr[1])); //$arr[1]
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");header("Content-Description: File Transfer");
ob_flush();
flush();
$fp = fopen($url, "r");//$url variable with file url
while (!feof($fp)) {
echo fread($fp, 65536);
ob_flush();
flush();
}
fclose($fp);
Thanks!