Skip to content

Instantly share code, notes, and snippets.

@raazon
Last active September 3, 2021 15:46
Show Gist options
  • Save raazon/c27214d0a4e30531c5435ac13c236cf0 to your computer and use it in GitHub Desktop.
Save raazon/c27214d0a4e30531c5435ac13c236cf0 to your computer and use it in GitHub Desktop.
copy file one server to another using php
<?php
/*
* REF: https://shellcreeper.com/move-files-server-to-server-using-simple-php/
*/
// Insert this file on server and go to the path from browser.
set_time_limit(0); // Unlimited max execution time
/* 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 $local_file...\n";
}
else{
echo "WOOT! success to copy $local_file...\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment