Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Connect and login to FTP server
- $ftp_server = "hostname";
- $ftp_username ="username";
- $ftp_userpass = "password";
- $includes = "/directory/";
- $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
- $login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
- // Get file list
- $contents = ftp_nlist($conn_id, $includes);
- // Loop through for file 1
- foreach ($contents as $file) {
- $local_file = '/path/to/file.php';
- $server_file = '/path/to/file.php';
- ftp_get($conn_id, $local_file, $server_file, FTP_BINARY);
- }
- // Loop through for file 2
- foreach ($contents as $file) {
- $local_file = '/path/to/file.php';
- $server_file = '/path/to/file.php';
- ftp_get($conn_id, $local_file, $server_file, FTP_BINARY);
- }
- // close connection
- ftp_close($ftp_conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement