It is quite difficult to transfer web site from one server to another. Here is a solution for server to server ftp transfer.
- Zip the required files as one file. The zipping feature is usually available in your web hosting control panel’s file manager.
- Upload the below mentioned script on the source server.
- Run the script on the source server.
- This will transfer files from one server to the other.
- Unzip the files on the destination server.
<?php
$server = “ftp.you-server.com”; //address of ftp server (leave out ftp://)
$ftp_user_name = “userName”; // Username
$ftp_user_pass = “passwordHere”; // Password
$source = “/home/folder/public_html/filename.ext”;
$dest = “/public_html/filename.ext”;
$mode=”FTP_BINARY”;
$connection = ftp_connect($server);
$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
if (!$connection || !$login) { die(‘Connection attempt failed!’); }
$upload = ftp_put($connection, $dest, $source, FTP_BINARY);
if (!$upload) { echo ‘FTP upload failed!’; }
ftp_close($connection);
echo “done”;
?>


