Note that there are some explanatory texts on larger screens.

plurals
  1. POTransfer from Server > Server > Client without download to server
    text
    copied!<p>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.</p> <p>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).</p> <p>There's any alternatives for that? I was thinking about something like:</p> <pre><code>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"); </code></pre> <p>But didn't work as expected.</p> <p>Thanks in advance</p> <hr> <p>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</p> <pre><code>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); </code></pre> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload