当前位置: 首页>>代码示例>>PHP>>正文


PHP Net_SFTP类代码示例

本文整理汇总了PHP中Net_SFTP的典型用法代码示例。如果您正苦于以下问题:PHP Net_SFTP类的具体用法?PHP Net_SFTP怎么用?PHP Net_SFTP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Net_SFTP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: escribe_archivo_via_sftp

function escribe_archivo_via_sftp($cadena, $nombre_archivo_remoto = "", $factura_id, $fe_folio)
{
    $sql_update = "update vta_p_facturas set \n\tFE_SERIE='A', FE_FOLIO={$fe_folio}\n\twhere (FE_SERIE = '' OR FE_SERIE IS NULL or FE_SERIE=0) AND (FE_FOLIO = '' OR FE_FOLIO IS NULL or FE_FOLIO =0) \n\tAND FACTURA_ID=" . $factura_id;
    $result_update = mysql_db_query(DB_NAME, $sql_update);
    // echo $sql_update;
    define("TEPath", "../TableEditor/");
    include '../TableEditor/Net/SFTP.php';
    //  $ftp_sitio="demo-partners.xsa.com.mx";
    //  $ftp_usuario="testftpfacciisa";
    //  $ftp_pass="testftpfacciisa";
    $ftp_sitio = "173.205.255.84";
    $ftp_usuario = "ftpciisa";
    $ftp_pass = "ciisa201104";
    $sftp = new Net_SFTP($ftp_sitio);
    if (!$sftp->login($ftp_usuario, $ftp_pass)) {
        exit('Acceso incorrecto..');
    }
    $sftp->put($nombre_archivo_remoto, utf8_encode($cadena));
    $sftp->chdir("1");
    $sftp->put($nombre_archivo_remoto, utf8_encode($cadena));
    $folio_fiscal = consulta("select FOLIO_FISCAL from vta_p_facturas WHERE FACTURA_ID=" . $factura_id);
    $folio_fiscal = $folio_fiscal["FOLIO_FISCAL"];
    //echo $fe_serie["FE_FOLIO"]."+";
    echo "Envio exitoso... Factura " . $folio_fiscal;
}
开发者ID:alexlqi,项目名称:adminte_git,代码行数:25,代码来源:funciones_generales.php

示例2: getCommand

 public function getCommand(\Net_SFTP $ssh)
 {
     $gitCommand = str_replace("\n", '', $ssh->exec('which git'));
     if ($gitCommand == '') {
         throw new \Exception('the git command wasn\'t found on this server');
     }
     return $gitCommand;
 }
开发者ID:onigoetz,项目名称:deployer,代码行数:8,代码来源:Git.php

示例3: scpRemoteLocal

 /**
  * copy a file from the remote server to the local install
  * @param $source string
  * @param $destination string
  * @return bool
  */
 public function scpRemoteLocal($source, $destination)
 {
     $sftp = new \Net_SFTP(Setting::getSetting('remote:host'));
     $key = new Crypt_RSA();
     $key->loadKey(file_get_contents(Setting::getSetting('ssh:priv_key')));
     if (!$sftp->login(Setting::getSetting('remote:user'), $key)) {
         $cli = new CLImate();
         $cli->error("Could not connect to server");
         return false;
     }
     $sftp->get($source, $destination);
 }
开发者ID:VonUniGE,项目名称:consh,代码行数:18,代码来源:SSHConnection.php

示例4: sftp_printer

function sftp_printer($xml_file)
{
    if (strrpos(get_include_path(), "phpseclib0.3.0") === false) {
        set_include_path(get_include_path() . PATH_SEPARATOR . './phpseclib0.3.0');
        // Staging requires the ../ to be ./
    }
    include 'Net/SFTP.php';
    $rtn = false;
    $sftp = new Net_SFTP('ftp.tginc.com', 2222);
    if (isset($_GET['tID'])) {
        echo $sftp->login('flatterbox', 'T&!Fl@!!er');
    }
    //if ( isset($_GET['tID']) ) : print_r( $sftp->getSupportedVersions() ); endif;
    if (!$sftp->login('flatterbox', 'T&!Fl@!!er') || true) {
        $rtn = 'Login Failed';
    }
    $local_directory = './orderlist/';
    // Set in previous function -- orderlist/';
    $remote_directory = '/incoming/';
    //echo $local_directory.'<br/>';
    //echo $remote_directory.'<br/>';
    $files_to_upload = array();
    if ($xml_file != "." && $xml_file != "..") {
        $files_to_upload[] = $xml_file;
    }
    if (!empty($files_to_upload) && $rtn == false) {
        foreach ($files_to_upload as $file) {
            /*
            echo dirname(__FILE__).'<br/>';
            echo $file.'<br/>';
            echo $local_directory . $file.'<br/>';
            */
            //$rtn = $sftp->put($remote_directory . $file, $local_directory . $file, NET_SFTP_LOCAL_FILE);
            $data = file_get_contents($local_directory . $file);
            if (isset($_GET['tID'])) {
                echo $data;
            }
            $rtn = $sftp->put($remote_directory . $file, $data);
        }
    }
    return $rtn;
    /*
    	$conn = ssh2_connect('ftp.tginc.com', 2222);
    	ssh2_auth_password($conn, 'flatterbox', 'T&!Fl@!!er');
    
    	// send a file
    	return ssh2_scp_send($conn, $local_directory.$xml_file, $remote_directory.$xml_file, 0644);
    */
}
开发者ID:avijitdeb,项目名称:flatterbox.com,代码行数:49,代码来源:tmp1234.php

示例5: connect

 public function connect()
 {
     // we have to mangle the include path a little to find our plugins
     $oldIncludePath = get_include_path();
     set_include_path($oldIncludePath . ':' . TL_ROOT . '/plugins/phpseclib/:' . TL_ROOT . '/plugins/phpseclib/Net:' . TL_ROOT . '/plugins/phpseclib/Crypt');
     include 'SFTP.php';
     if ($GLOBALS['TL_CONFIG']['sftpKeyFile']) {
         include 'RSA.php';
     }
     set_include_path($oldIncludePath);
     $this->ftpHost = $GLOBALS['TL_CONFIG']['ftpHost'];
     $this->ftpPort = $GLOBALS['TL_CONFIG']['ftpPort'];
     $this->ftpUser = $GLOBALS['TL_CONFIG']['ftpUser'];
     if ($GLOBALS['TL_CONFIG']['sftpKeyFile']) {
         $key = new Crypt_RSA();
         if ($GLOBALS['TL_CONFIG']['sftpKeyPass']) {
             $key->setPassword($GLOBALS['TL_CONFIG']['sftpKeyPass']);
         }
         $key->loadKey(file_get_contents($GLOBALS['TL_CONFIG']['sftpKeyFile']));
         $this->ftpPass = $key;
     } else {
         $this->ftpPass = $GLOBALS['TL_CONFIG']['ftpPass'];
     }
     $this->ftpPath = $GLOBALS['TL_CONFIG']['ftpPath'];
     // Connect to FTP server
     if (!is_numeric($this->ftpPort) || $this->ftpPort == 0) {
         $this->ftpPort = 22;
     }
     if ($GLOBALS['TL_CONFIG']['debugSmhExtended']) {
         define('NET_SSH2_LOGGING', true);
         define('NET_SFTP_LOGGING', true);
     }
     if (($resConnection = new Net_SFTP($this->ftpHost, $this->ftpPort, 5)) != false) {
         // Login
         if (!$resConnection->login($this->ftpUser, $this->ftpPass)) {
             throw new Exception('Could not login to sftp: ' . $resConnection->getLastError() . (defined('NET_SSH2_LOGGING') ? implode("\n", $resConnection->message_number_log) : ''));
         }
         // security, clean user id and password as we won't need them anymore.
         $this->ftpUser = NULL;
         $this->ftpPass = NULL;
         // change to root directory to ensure we can really work.
         $resConnection->chdir($this->ftpPath);
         $this->resConnection = $resConnection;
         return $resConnection;
     } else {
         throw new Exception('Could not connect to sftp: ' . $resConnection->getLastError());
     }
 }
开发者ID:unmaintained-stuff,项目名称:tl_smhextended,代码行数:48,代码来源:SMHSFTP.php

示例6: getSftp

 /**
  * @param array $config
  *
  * @throws Mageplace_Backup_Exception|Mage_Core_Exception
  * @return Net_SFTP
  */
 public function getSftp(array $config = array())
 {
     if ($this->_getData('sftp') === null) {
         $host = $this->getConfigValue(self::HOST);
         $port = (int) $this->getConfigValue(self::PORT);
         if ($port <= 0) {
             $port = self::DEFAULT_PORT;
         }
         $sftp = new Net_SFTP($host, $port, $this->getTimeOut());
         if (!$sftp->login($this->getConfigValue(self::USERNAME), $this->getConfigValue(self::PASSWORD))) {
             $this->_throwExeption($this->_helper->__("SFTP connection error: unable to open connection as %s@%s:%d", $this->getConfigValue(self::USERNAME), $host, $port));
         }
         if ($path = rtrim($this->getConfigValue(self::PATH), '/')) {
             if (!$sftp->chdir($path)) {
                 $this->_throwExeption($this->_helper->__('SFTP connection error: invalid path'));
             }
         }
         $this->setData('sftp', $sftp);
     }
     return $this->_getData('sftp');
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:27,代码来源:Sftp.php

示例7: connect

 /**
  * @param \Cogeco\Build\Entity\Host $host
  * @return \Net_SFTP
  * @throws \Cogeco\Build\Exception
  */
 public static function connect(Host $host)
 {
     // Throw an exception if no host is provided
     if (empty($host)) {
         throw new Exception(__METHOD__ . "() No host specified");
     }
     // If the connection doesn't already exist, create it
     if (empty(self::$handles[$host->hostname])) {
         self::log("- Starting an SSH session on {$host->hostname} for user {$host->account->username}\n\n");
         self::$handles[$host->hostname] = $handle = new \Net_SFTP($host->hostname);
         if (!$handle->login($host->account->username, $host->account->password)) {
             throw new Exception(__METHOD__ . '() SSH connection failed');
         }
         // Set the home folder, if it isn't explicitly set already
         $homeDirPath = $handle->pwd();
         if (empty($host->homeDirPath) && !empty($homeDirPath)) {
             $host->homeDirPath = $homeDirPath;
         }
     }
     return self::$handles[$host->hostname];
 }
开发者ID:primat,项目名称:deployer-org,代码行数:26,代码来源:SshTask.php

示例8: getConnection

 /**
  * Returns the connection.
  *
  * @return \Net_SFTP connected client instance
  * @throws \Exception when the connection failed
  */
 public function getConnection()
 {
     if (!is_null($this->client)) {
         return $this->client;
     }
     $hostKeys = $this->readHostKeys();
     $this->client = new \Net_SFTP($this->host);
     // The SSH Host Key MUST be verified before login().
     $currentHostKey = $this->client->getServerPublicHostKey();
     if (array_key_exists($this->host, $hostKeys)) {
         if ($hostKeys[$this->host] != $currentHostKey) {
             throw new \Exception('Host public key does not match known key');
         }
     } else {
         $hostKeys[$this->host] = $currentHostKey;
         $this->writeHostKeys($hostKeys);
     }
     if (!$this->client->login($this->user, $this->password)) {
         throw new \Exception('Login failed');
     }
     return $this->client;
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:28,代码来源:sftp.php

示例9: explode

        pb_backupbuddy::alert(__('No backups were deleted.', 'it-l10n-backupbuddy'));
    }
    echo '<br>';
}
// Connect to server.
$server = $destination['address'];
$port = '22';
// Default sFTP port.
if (strstr($server, ':')) {
    // Handle custom sFTP port.
    $server_params = explode(':', $server);
    $server = $server_params[0];
    $port = $server_params[1];
}
pb_backupbuddy::status('details', 'Connecting to sFTP server...');
$sftp = new Net_SFTP($server, $port);
if (!$sftp->login($destination['username'], $destination['password'])) {
    pb_backupbuddy::status('error', 'Connection to sFTP server FAILED.');
    return false;
} else {
    pb_backupbuddy::status('details', 'Success connecting to sFTP server.');
}
pb_backupbuddy::status('details', 'Attempting to create path (if it does not exist)...');
if (true === $sftp->mkdir($destination['path'])) {
    // Try to make directory.
    pb_backupbuddy::status('details', 'Directory created.');
} else {
    pb_backupbuddy::status('details', 'Directory not created.');
}
// List files.
$files = $sftp->rawlist($destination['path']);
开发者ID:elephantcode,项目名称:elephantcode,代码行数:31,代码来源:_manage.php

示例10: poll_hl7_results

/**
 * Poll all eligible labs for new results and store them in the database.
 *
 * @param  array   &$info  Conveys information to and from the caller:
 * FROM THE CALLER:
 * $info["$ppid/$filename"]['delete'] = a non-empty value if file deletion is requested.
 * $info['select'] = array of patient matching responses where key is serialized patient
 *   attributes and value is selected pid for this patient, or 0 to create the patient.
 * TO THE CALLER:
 * $info["$ppid/$filename"]['mssgs'] = array of messages from this function.
 * $info['match'] = array of patient matching requests where key is serialized patient
 *   attributes (ss, fname, lname, DOB) and value is TRUE (irrelevant).
 *
 * @return string  Error text, or empty if no errors.
 */
function poll_hl7_results(&$info)
{
    global $srcdir;
    // echo "<!-- post: "; print_r($_POST); echo " -->\n"; // debugging
    // echo "<!-- in:   "; print_r($info); echo " -->\n"; // debugging
    $filecount = 0;
    $badcount = 0;
    if (!isset($info['match'])) {
        $info['match'] = array();
    }
    // match requests
    if (!isset($info['select'])) {
        $info['select'] = array();
    }
    // match request responses
    $ppres = sqlStatement("SELECT * FROM procedure_providers ORDER BY name");
    while ($pprow = sqlFetchArray($ppres)) {
        $ppid = $pprow['ppid'];
        $protocol = $pprow['protocol'];
        $remote_host = $pprow['remote_host'];
        $hl7 = '';
        if ($protocol == 'SFTP') {
            $remote_port = 22;
            // Hostname may have ":port" appended to specify a nonstandard port number.
            if ($i = strrpos($remote_host, ':')) {
                $remote_port = 0 + substr($remote_host, $i + 1);
                $remote_host = substr($remote_host, 0, $i);
            }
            ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . "{$srcdir}/phpseclib");
            require_once "{$srcdir}/phpseclib/Net/SFTP.php";
            // Compute the target path name.
            $pathname = '.';
            if ($pprow['results_path']) {
                $pathname = $pprow['results_path'] . '/' . $pathname;
            }
            // Connect to the server and enumerate files to process.
            $sftp = new Net_SFTP($remote_host, $remote_port);
            if (!$sftp->login($pprow['login'], $pprow['password'])) {
                return xl('Login to remote host') . " '{$remote_host}' " . xl('failed');
            }
            $files = $sftp->nlist($pathname);
            foreach ($files as $file) {
                if (substr($file, 0, 1) == '.') {
                    continue;
                }
                ++$filecount;
                if (!isset($info["{$ppid}/{$file}"])) {
                    $info["{$ppid}/{$file}"] = array();
                }
                // Ensure that archive directory exists.
                $prpath = $GLOBALS['OE_SITE_DIR'] . "/procedure_results";
                if (!file_exists($prpath)) {
                    mkdir($prpath);
                }
                $prpath .= '/' . $pprow['ppid'];
                if (!file_exists($prpath)) {
                    mkdir($prpath);
                }
                // Get file contents.
                $hl7 = $sftp->get("{$pathname}/{$file}");
                // If user requested reject and delete, do that.
                if (!empty($info["{$ppid}/{$file}"]['delete'])) {
                    $fh = fopen("{$prpath}/{$file}.rejected", 'w');
                    if ($fh) {
                        fwrite($fh, $hl7);
                        fclose($fh);
                    } else {
                        return xl('Cannot create file') . ' "' . "{$prpath}/{$file}.rejected" . '"';
                    }
                    if (!$sftp->delete("{$pathname}/{$file}")) {
                        return xl('Cannot delete (from SFTP server) file') . ' "' . "{$pathname}/{$file}" . '"';
                    }
                    continue;
                }
                // Do a dry run of its contents and check for errors and match requests.
                $tmp = receive_hl7_results($hl7, $info['match'], $ppid, $pprow['direction'], true, $info['select']);
                $info["{$ppid}/{$file}"]['mssgs'] = $tmp['mssgs'];
                // $info["$ppid/$file"]['match'] = $tmp['match'];
                if (!empty($tmp['fatal']) || !empty($tmp['needmatch'])) {
                    // There are errors or matching requests so skip this file.
                    continue;
                }
                // Now the money shot - not a dry run.
                $tmp = receive_hl7_results($hl7, $info['match'], $ppid, $pprow['direction'], false, $info['select']);
                $info["{$ppid}/{$file}"]['mssgs'] = $tmp['mssgs'];
//.........这里部分代码省略.........
开发者ID:mi-squared,项目名称:openemr,代码行数:101,代码来源:receive_hl7_results.inc.php

示例11: Net_SFTP

	//$to = "smccready@usimagingnetwork.com";
	$subject =  "[Important] Encryption Failed for ".$recipient." Weekly Appointment Summary";
	mail($to,$subject,$msg);

	exit(0);
}*/
//if(file_exists($encryptedFileName))
if (file_exists($localfilename)) {
    include "Net/SFTP.php";
    $ftp_server = 'PDCFTP.cvty.com';
    $ftp_user = 'USImaging';
    $ftp_password = '0651Srqk0688Osuc';
    $ftp_port = '21000';
    $ftp_directory = '/Incoming/';
    //'/Test/Incoming/'
    $sftp = new Net_SFTP($ftp_server, $ftp_port);
    // FTP Login
    if ($sftp->login($ftp_user, $ftp_password)) {
        // Change directory
        if ($sftp->chdir($ftp_directory)) {
            if ($sftp->put($remoteFileName, $localfilename, NET_SFTP_LOCAL_FILE)) {
                $destFileName = str_replace('C:\\Inetpub\\wwwroot\\plexis\\php\\', 'D:\\Documents\\Misc\\' . $clientName . "_", $savePathAndFileName);
                //echo "destFileName:  ".$destFileName."\n";
                //echo "localfilename:  ".$localfilename."\n";
                //echo "remoteFileName:  ".$remoteFileName."\n";
                if (file_exists($destFileName)) {
                    unlink($destFileName);
                }
                rename($localfilename, $destFileName);
            } else {
                $msg = "Unable to put " . $localfilename . " file to [" . $ftp_server . "] /" . $ftp_directory . "/" . $remoteFileName . "<br/>";
开发者ID:jasmith152,项目名称:plexis,代码行数:31,代码来源:Weekly_Appointment_Summary.php

示例12: createSFTPSession

 public function createSFTPSession()
 {
     $sftp_url = $this->config['batch_url'];
     $sftp_username = $this->config['sftp_username'];
     $sftp_password = $this->config['sftp_password'];
     $session = new \Net_SFTP($sftp_url);
     if (!$session->login($sftp_username, $sftp_password)) {
         throw new \RuntimeException("Failed to SFTP with the username {$sftp_username} and the password {$sftp_password} to the host {$sftp_url}. Check your credentials!");
     }
     return $session;
 }
开发者ID:siscodev93,项目名称:litle-sdk-for-php,代码行数:11,代码来源:LitleRequest.php

示例13: Net_SFTP

 $mail->Body = "U prilogu je izvestaj o storno stavkama u txt formatu";
 //HTML Body
 $mail->AltBody = "AltBody - U prilogu je izvestaj o storno stavkama u txt formatu";
 // optional, comment out and test
 $mail->WordWrap = 50;
 // set word wrap
 //$mail->MsgHTML($body);
 // send email
 //$mail = mail($to,$subject,$message,$header);
 if (!$mail->Send()) {
     echo "Mailer Error: " . $mail->ErrorInfo;
 } else {
     echo "Message sent!";
 }
 //unlink('/tmp/kontakti.txt');
 $sftp = new Net_SFTP('podrska.bbtrade.rs');
 if (!$sftp->login('root', 'bbsb100$')) {
     echo "Login Failed";
     exit('Login Failed');
 }
 // outputs the contents of filename.remote to the screen
 //echo $sftp->get('/tmp/kontakti.txt');
 // copies filename.remote to filename.local from the SFTP server
 //$sftp->get('/tmp/kontakti.txt', '\\C$\Users\%username%\Desktop\kontakti.txt');
 $sftp->get('/tmp/izvestaj.csv', '/cygdrive/c/storno/izvestaj.txt');
 //ssh2.sftp://{$resSFTP}/cygdrive/c/to/path
 if ($sftp->delete('/tmp/izvestaj.csv')) {
     // doesn't delete directories
     echo "File /tmp/izvestaj.csv je obrisan!";
 } else {
     echo "File /tmp/izvestaj.csv nije obrisan!";
开发者ID:GoranSubic,项目名称:storno,代码行数:31,代码来源:svimpodatum-sum.php

示例14: downloadFromFulfillment

 public function downloadFromFulfillment()
 {
     $arrayCsvFiles = array();
     $arrayCsvFilesClear = array();
     $sql = "SELECT *\n                FROM `fulfillment_files`\n                WHERE `fulfillment_id`=?i";
     $result = self::$_msql->getInd('filename', $sql, $this->fulfillment_id);
     if ($this->ssl) {
         $sftp = new Net_SFTP($this->server);
         if (!$sftp->login($this->username, $this->password)) {
             exit('Login Failed');
         }
         //$contents = $sftp->nlist("{$this->download_path}");
         $dPath = trim($this->download_path, '/');
         $contents = $sftp->nlist("{$dPath}");
         if (!$contents) {
             return;
         }
         foreach ($contents as $file) {
             if (substr($file, -4, 4) == '.csv') {
                 $arrayCsvFiles[] = $arrayCsvFilesClear[] = $file;
             }
         }
         foreach ($arrayCsvFiles as $file) {
             $tF = explode('/', $file);
             $fName = array_pop($tF);
             if (isset($result["{$fName}"])) {
                 continue;
             }
             $downloadFilePath = AF::path(time() . rand(1, 1000), array('files', 'csv', 'temp'), 'csv');
             if ($sftp->get($dPath . '/' . $file, $downloadFilePath)) {
                 self::parserCsvFiles($downloadFilePath);
                 $sql = "INSERT INTO `fulfillment_files` (`fulfillment_id`, `filename`, `time`) VALUES (?i, ?s, NOW())";
                 self::$_msql->query($sql, $this->fulfillment_id, $fName);
             }
         }
         $sftp->_disconnect(0);
     } else {
         $ftp = ftp_connect($this->server, $this->port, 300);
         if (!$ftp) {
             return;
         }
         if ($this->username && $this->password) {
             ftp_login($ftp, $this->username, $this->password);
         }
         ftp_pasv($ftp, true);
         // Passive mode
         $contents = ftp_nlist($ftp, "{$this->download_path}");
         if (!$contents) {
             return;
         }
         foreach ($contents as $file) {
             if (substr($file, -4, 4) == '.csv') {
                 $file = str_replace('\\', '/', $file);
                 $arrayCsvFiles[] = $file;
                 $tF = explode('/', $file);
                 $arrayCsvFilesClear[] = (string) trim(array_pop($tF));
             }
         }
         foreach ($arrayCsvFiles as $file) {
             $tF = explode('/', $file);
             $fName = (string) trim(array_pop($tF));
             if (isset($result["{$fName}"])) {
                 continue;
             }
             $downloadFilePath = AF::path(time() . rand(1, 1000), array('files', 'csv', 'temp'), 'csv');
             if (ftp_get($ftp, $downloadFilePath, $file, FTP_ASCII)) {
                 self::parserCsvFiles($downloadFilePath);
                 $sql = "INSERT INTO `fulfillment_files` (`fulfillment_id`, `filename`, `time`) VALUES (?i, ?s, NOW())";
                 self::$_msql->query($sql, $this->fulfillment_id, $fName);
             }
         }
         ftp_close($ftp);
     }
     $sql = "DELETE FROM `fulfillment_files`\n                WHERE `fulfillment_id` = ?i\n                AND `filename` NOT IN (?a)";
     self::$_msql->query($sql, $this->fulfillment_id, $arrayCsvFilesClear);
 }
开发者ID:,项目名称:,代码行数:76,代码来源:

示例15: _getFile

 /**
  * get a file
  *
  * @param String $source_file      the target file to download
  * @param bool   $destination_file the save path
  *
  * @return String
  * @throws CMbException
  */
 private function _getFile($source_file, $destination_file = false)
 {
     if (!$this->connexion) {
         throw new CMbException("CSourceSFTP-connexion-failed", $this->hostname);
     }
     // Download the file
     if (!($data = $this->connexion->get($source_file, $destination_file))) {
         throw new CMbException("CSourceSFTP-download-file-failed", $source_file, $destination_file);
     }
     return $data;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:20,代码来源:CSFTP.class.php


注:本文中的Net_SFTP类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。