Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ////FOR SFTP
- ini_set('error_reporting', E_ALL);
- $strServer = "ftp.digitalriver.com.wip.digitalrivercontent.net";
- $strServerPort = "2222";
- $strServerUsername = "ms_api";
- $strServerPassword = "tenroh";
- $csv_filename = "test.csv";
- //connect to server
- $resConnection = ssh2_connect("$strServer","$strServerPort");
- if ($resConnection) die('Connection failed');
- if(ssh2_auth_password($resConnection, $strServerUsername, $strServerPassword)){
- //Initialize SFTP subsystem
- echo "connected";
- $resSFTP = ssh2_sftp($resConnection);
- var_dump($resSFTP);
- $resFile = fopen("ssh2.sftp://".$resSFTP."/Magento/".$csv_filename, 'w');
- $srcFile = fopen("/chroot/home/bluehorn/magentodev.bluehornet.com/html/".$csv_filename, 'r');
- $writtenBytes = stream_copy_to_stream($srcFile, $resFile);
- fclose($resFile);
- fclose($srcFile);
- echo "Uploaded successfully";
- }else{
- echo "Unable to authenticate on server";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement