deam0n Moderator Екип 16 Юли 2013 #2 1. Код: <?php copy('http://somedomain.com/file.jpeg', '/tmp/file.jpeg'); ?> 2. Код: <?php //Get the file $content = file_get_contents("http://example.com/image.jpg"); //Store in the filesystem. $fp = fopen("/location/to/save/image.jpg", "w"); fwrite($fp, $content); fclose($fp); ?> 3. Код: <?php $url = "http://other-site/image.png"; $dir = "/my/local/dir/"; $rfile = fopen($url, "r"); $lfile = fopen($dir . basename($url), "w"); while(!feof($url)) fwrite($lfile, fread($rfile, 1), 1); fclose($rfile); fclose($lfile); ?>
1. Код: <?php copy('http://somedomain.com/file.jpeg', '/tmp/file.jpeg'); ?> 2. Код: <?php //Get the file $content = file_get_contents("http://example.com/image.jpg"); //Store in the filesystem. $fp = fopen("/location/to/save/image.jpg", "w"); fwrite($fp, $content); fclose($fp); ?> 3. Код: <?php $url = "http://other-site/image.png"; $dir = "/my/local/dir/"; $rfile = fopen($url, "r"); $lfile = fopen($dir . basename($url), "w"); while(!feof($url)) fwrite($lfile, fread($rfile, 1), 1); fclose($rfile); fclose($lfile); ?>