Copy files from server to server using PHP

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:

/**
 * Transfer Files Server to Server using PHP Copy
 * @link https://omwebtech.com/copy-files-from-server-to-server-using-php/
 */
 
/* Source File URL */
$remote_file_url = 'http://origin-server-url/files.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! failed to copy $file...\n";
}
else{
    echo "WOOT! success to copy $file...\n";
}

About

Website development,php development,wordpress development,joomla development,Symfony development,iOS development,Android development,XHTML designer,HTML5 designer,responsive web design,twitter bootstrap design, hire designer, hire developer

Follow The Author

Leave a Replay

Your email address will not be published. Required fields are marked *

*
*