Sometimes you need to move/migrate files to another server/hosting, and you/your client only have FTP access to the server. And to download these files and re-upload to another server can take a lot of time using FTP client such as Filezilla. FTP do not have zip – unzip functionality, so you need to upload it one by one. And server to server transfer is a lot faster than downloading and uploading the files.
You can use this simple PHP script to move files from one server to another server.
Using PHP Copy to move files from server to server.
You can just create a php file in the destination server and load the file once in your browser. For example you add this code in http://destination-url/copy-files.php and in copy-files.php you add this php code:
<?php $remote_file_url = 'https://www.webappsplanet.com/filename.zip'; /* New file name and path for this file */ $local_file = 'files.zip'; /* Copy the file from source url to server */ $copy = copy( $remote_file_url, $local_file ); /* Add notice for success/failure */ if( !$copy ) { echo "Doh! copy failed $file...\n"; } else{ echo "WOOT! successfuly copied $file...\n"; }