Current Path :
/
home
/
zrcdevco
/
public_html
/
zrc-email-program
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/zrcdevco/public_html/zrc-email-program/zrc_ftp_files.php
<?php // Function to download the FTP files from the Reed Server function download_reed_files($startDate, $endDate) { // Connect to FTP // $conn_id = ftp_connect('ftp.reeddatalink.com'); $conn_id = ftp_connect('ftp.cmdintegration.com'); // login with username and password $login_result = ftp_login($conn_id, 'zrcworldwide', 'ZrCW0rlD!'); echo "Login Results: $login_result\n"; $processDate = $startDate; while ($processDate <= $endDate) { echo 'Process Date: '.$processDate.'</br>'; echo "<br />Start\n"; echo date("l jS \of F Y h:i:s A") . "<br>"; // Reed Insight files contain a date stamp so new code will be required to // add the date stamp. // Use ftp to retrieve the files from the Reed Server // define some variables $file_date = str_replace('-','',$processDate); $zipfile_name = "DL_ZRCWorldwide_CSV_" . $file_date . ".zip"; $local_file = $zipfile_name; $server_file = '/zrcworldwide_insight/'.$zipfile_name; // 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 writing to $local_file\n"; } echo date("l jS \of F Y h:i:s A") . "<br>"; // increment process date $date = new DateTime($processDate); $date->add(new DateInterval('P1D')); $processDate = $date->format('Y-m-d'); echo date("l jS \of F Y h:i:s A") . "<br>"; } } ?>