I'm trying to download a file with this code and store in on my server:
set_time_limit(1000);
// copy the remote file
$uri = 'file';
$contents = file_get_contents($uri);
$filename = basename($uri);
// create the local file
$fp = fopen($filename, 'w');
fwrite($fp, $contents);
fclose($fp);
When I'm downloading a zip file (file.zip) of 4 MB the script is working ok, but a soon I try with a text file of 30MB (file.txt) I get this errors!
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/getfile.php on line 6
Warning: file_get_contents(http://domain.com/file.txt): failed to open stream: Connection timed out in /home/getfile.php on line 6
Anybody know why? I set the time limit of the script so there shouldn't be any problem!