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/cmd_sftp_test.php
<?php // Test connection to the CMD SFTP Server $connection = ssh2_connect('sftp.cmdintegration.com', 2220); ssh2_auth_password($connection, 'zrcworldwide', 'MRUSWZzgmfld516^'); $sftp = ssh2_sftp($connection); // Download ZIP format files using FTP - one per day while ($processDate <= $newEnd) { 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. $file_date = str_replace('-','',$processDate); $zipfile_name = "1.3_DL_ZRCWorldwide_XML_" . $file_date . ".zip"; $local_file = $zipfile_name; $server_file = '/zrcworldwide_insight/'.$zipfile_name; // try to download $server_file and save to $local_file $stream = fopen('ssh2.sftp://' . intval($sftp) . '/path/to/file', 'r'); 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>"; } ?>