Here is my prob in Brief.
I know how to upload a file to server using FTP with programming language PHP.
But is that possible to get files from another server to our server using PHP with
having the FTP Username and Password
Thanks n advance...
Fero
Technically, the FTP protocol allows for server-to-server transfers, called FXP. This feature is disabled by default on most FTP servers, though, for security reasons, so you would need to be able to verify/enable it before it would work.
If it is enabled, you should just need to script the FXP commands and everything should work fine.
Yes, you can fetch files from FTP using PHP - using ftp_get
.
The following snippet is from the documentation:
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n";
}
else {
echo "There was a problem\n";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With