1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
$folder_path = "YOUR FOLDER PATH";
$local_file = "test.xml";
$server_file = "test.xml";
//-- Connection Settings
$ftp_server = "mondomaine.com"; // Address of FTP server.
$ftp_user_name = "********"; // Username
$ftp_user_pass = "***********"; // Password
#$destination_file = "FILEPATH";
// set up basic connection
$conn_id = ftp_connect($ftp_server,21);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// Récupération du délai de connexion du flux FTP courant
$timeout = ftp_get_option($conn_id, FTP_TIMEOUT_SEC);
// 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";
}
// close the connection
ftp_close($conn_id); |
Partager