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


PHP ssh2_scp_recv函数代码示例

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


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

示例1: receive

 /**
  *
  * @param string $remoteFileName            
  * @param string $localFilename            
  * @throws \Exception
  */
 public function receive($remoteFileName, $localFilename)
 {
     if (empty($this->session)) {
         throw new \Exception("Veuillez vous connecter au serveur avant de demander un fichier");
     }
     ssh2_scp_recv($this->session, $remoteFileName, $localFilename);
 }
开发者ID:dsi-agpt,项目名称:minibus,代码行数:13,代码来源:ScpClient.php

示例2: download_file

 function download_file($file_path, $new_file_path)
 {
     if ($this->sftp_connection) {
         return @ssh2_scp_recv($this->ssh2_connection, $file_path, $new_file_path);
     }
     return false;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:7,代码来源:SSH2Connection.php

示例3: scp_recv

 public function scp_recv($remote_path, $local_path)
 {
     if (!isset($this->socket) || !is_resource($this->socket)) {
         $this->connect();
     }
     try {
         ssh2_scp_recv($this->socket, $remote_path, $local_path);
         $this->disconnect();
     } catch (Exception $e) {
         // close the connection after scp command
         $this->error_handler($e);
     }
 }
开发者ID:sodonnell,项目名称:php,代码行数:13,代码来源:ssh2.php

示例4: download

 public function download($remoteFilename, $localFilename, $overwrite = false)
 {
     if (!$overwrite and file_exists($localFilename)) {
         throw new ConnectionException('File exists and overwrite flag is not set');
     }
     if (!is_writable(dirname($localFilename))) {
         throw new ConnectionException('Local directory is not writable');
     }
     if (!is_resource($this->sftpResource)) {
         throw new ConnectionException('Connection is not open');
     }
     $scpResult = @ssh2_scp_recv($this->sshResource, $this->getRemotePath($remoteFilename), $localFilename);
     if ($scpResult) {
         return $this;
     } else {
         throw new ConnectionException('Unable to download file');
     }
 }
开发者ID:mazhuravlev,项目名称:file-transfer,代码行数:18,代码来源:SFTPConnection.php

示例5: getFile

 public function getFile($remoteFile, $localFile)
 {
     $this->logAction("Receiving file {$remoteFile} as {$localFile}");
     if (ssh2_scp_recv($this->conn, $remoteFile, $localFile)) {
         return true;
     }
     $this->logAction("Receiving file {$remoteFile} as {$localFile} failed");
     throw new Exception("Unable to get file to {$remoteFile}");
 }
开发者ID:Namiastek,项目名称:SGD,代码行数:9,代码来源:SshService.php

示例6: scpRecv

 /**
  * Facade for file_put_contents over ssh2.
  *
  * @param resource $session     The sftp resource to use.
  * @param string   $remote_file The remote path to get from.
  * @param string   $local_file  The local file to write to.
  *
  * @return boolean True on success.
  */
 public function scpRecv($session, $remote_file, $local_file)
 {
     return ssh2_scp_recv($session, $remote_file, $local_file);
 }
开发者ID:zikula,项目名称:filesystem,代码行数:13,代码来源:SftpFacade.php

示例7: get

 public function get($remote, $local)
 {
     return ssh2_scp_recv($this->conn_, $remote, $local);
 }
开发者ID:nicevoice,项目名称:yhtx,代码行数:4,代码来源:Sftp.php

示例8: get_contents

 function get_contents($file, $type = '', $resumepos = 0)
 {
     $this->debug("get_contents();");
     $tempfile = wp_tempnam($file);
     if (!$tempfile) {
         return false;
     }
     if (!ssh2_scp_recv($this->link, $file, $tempfile)) {
         return false;
     }
     $contents = file_get_contents($tempfile);
     unlink($tempfile);
     return $contents;
 }
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:14,代码来源:class-wp-filesystem-ssh2.php

示例9: dol_syslog

if ($connection) {
    if (!@ssh2_auth_password($connection, $login, $password)) {
        dol_syslog("Could not authenticate with username " . $login . " . and password " . $password, LOG_ERR);
        exit(-5);
    } else {
        //$stream = ssh2_exec($connection, '/usr/bin/php -i');
        /*
        print "Generate dump ".$filesys1.'.bz2'."\n";
        	$stream = ssh2_exec($connection, "mysqldump -u debian-sys-maint -p4k9Blxl2snq4FHXY -h 127.0.0.1 --single-transaction -K --tables -c -e --hex-blob --default-character-set=utf8 saasplex | bzip2 -1 > ".$filesys1.'.bz2');
        	stream_set_blocking($stream, true);
        	// The command may not finish properly if the stream is not read to end
        	$output = stream_get_contents($stream);
        */
        $sftp = ssh2_sftp($connection);
        print 'Get file ' . $sourcefile . ' into ' . $targetdir . $targetfile . "\n";
        ssh2_scp_recv($connection, $sourcefile, $targetdir . $targetfile);
        $fullcommand = "cat " . $targetdir . $targetfile . " | mysql -h" . $databaseserver . " -u" . $loginbase . " -p" . $passwordbase . " -D " . $database;
        if (preg_match('/\\.bz2$/', $targetfile)) {
            $fullcommand = "bzip2 -c -d " . $targetdir . $targetfile . " | mysql -h" . $databaseserver . " -u" . $loginbase . " -p" . $passwordbase . " -D " . $database;
        }
        if (preg_match('/\\.gz$/', $targetfile)) {
            $fullcommand = "gzip -d " . $targetdir . $targetfile . " | mysql -h" . $databaseserver . " -u" . $loginbase . " -p" . $passwordbase . " -D " . $database;
        }
        print "Load dump with " . $fullcommand . "\n";
        $output = array();
        $return_var = 0;
        print strftime("%Y%m%d-%H%M%S") . ' ' . $fullcommand . "\n";
        exec($fullcommand, $output, $return_var);
        foreach ($output as $line) {
            print $line . "\n";
        }
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:sftpget_and_loaddump.php

示例10: ssh2_connect

///////////////////////////////////
// Abrindo conexão novamente ssh //
$connect_ssh = ssh2_connect($_SESSION['ipserver'], 22);
if (ssh2_auth_password($connect_ssh, $_SESSION['login'], $_SESSION['password'])) {
    echo "Conectado..." . "<br>";
}
//////////////////////////////////////
// Iniciando Deletagem das linha... //
$remote_file = "/etc/bind/named.conf.local";
//way arq a ser copiado
$local_file = "/tmp/named.conf.local.cpy";
//way arq copiado
$local_file_modif = "/tmp/named.conf.local.cpy.alt";
//wau arq alterado
// Copiando arquivo do server remote e testando se houver falha...returna false
if (!ssh2_scp_recv($connect_ssh, $remote_file, $local_file)) {
    return false;
}
//Abrir file
$file_original = fopen($local_file, 'r');
//abri arq para leitura
$file_alterado = fopen($local_file_modif, 'w');
//cria um arq zerado
// Var. para avisar se deve copiar ou não linha atual do laço
$delete_line = false;
//var. para ir increment. ate chegar a 4, q deve ser quando deve parar de exlucir as linhas
// o "excluir na verdade eh não copiar a linha para o arquivo $local_file_modif
$cont = 0;
for ($i = 0;; $i++) {
    $linha = fgets($file_original);
    if (strstr($linha, $_GET['domain']) || $delete_line) {
开发者ID:Gabrielsc,项目名称:DNS-ExtendWEB_NEW,代码行数:31,代码来源:del_zona.php

示例11: get

 /**
  * Copy a remote file on local filesystem.
  *
  * @param string  $local_file
  * @param string  $remote_file
  * @param boolean $overwrite
  *
  * @return boolean Returns TRUE on success or FALSE on error
  *
  * @throws \BackBee\Util\Transport\Exception\TransportException Occures if SSH connection is invalid
  */
 public function get($local_file, $remote_file, $overwrite = false)
 {
     if (null === $this->_sftp_resource || null === $this->_ssh_resource) {
         throw new TransportException(sprintf('None SSH connection available.'));
     }
     $remote_file = $this->_getAbsoluteRemotePath($remote_file);
     if (true === $overwrite || false === file_exists($local_file)) {
         if (false === @ssh2_sftp_stat($this->_sftp_resource, $remote_file)) {
             return $this->_trigger_error(sprintf('Could not open remote file: %s.', $remote_file));
         }
         if (false === @ssh2_scp_recv($this->_ssh_resource, $remote_file, $local_file)) {
             return $this->_trigger_error(sprintf('Could not send data from file %s to file %s.', $remote_file, $local_file));
         }
         return true;
     }
     return $this->_trigger_error(sprintf('Local file already exists: %s.', $local_file));
 }
开发者ID:mickaelsteinberg,项目名称:BackBee,代码行数:28,代码来源:SFTP.php

示例12: download

 /**
  * @param $remoteFile
  * @param $localFile
  * @return bool
  */
 public function download($remoteFile, $localFile)
 {
     return ssh2_scp_recv($this->connection->getConnection(), $remoteFile, $localFile);
 }
开发者ID:brabijan,项目名称:ssh,代码行数:9,代码来源:RemoteFilesystem.php

示例13: downloadFile_Single_Stream

 public function downloadFile_Single_Stream($local_file, $remote_file)
 {
     $connection_data = $this->getSSH2Connection();
     if (!$connection_data->connected) {
         //---------------------------------------------------------------------------------------------------------------
         if (PHP_SSH2MST_DEBUG) {
             echo "\n\n_____________FILE TRANSFER FAILED___________\n";
         }
         //---------------------------------------------------------------------------------------------------------------
         $this->parent->transfer_status = PHP_SSH2MST_TRANSFER_STATUS_FAILED;
         return 0;
     }
     $res = ssh2_scp_recv($connection_data->connection_handle, $remote_file, $local_file);
     //release the connection - we dont need it anymore
     $this->ReleaseConnection($connection_data);
     return $res;
 }
开发者ID:ostapski,项目名称:PHP_SSH2MST,代码行数:17,代码来源:php_ssh2mst.php

示例14: scpRecv

 public function scpRecv($remote_file, $local_file)
 {
     if (!($inifile = ssh2_scp_recv($this->con, $remote_file, $local_file))) {
         throw new \Exception('Unable to retrieve file');
     }
 }
开发者ID:ponbiki,项目名称:FTW2,代码行数:6,代码来源:Ssh2.php

示例15: getFile

 /**
  * Fetch a file from the remote server via SCP.
  *
  * @param string $remote_file
  * @param string $local_file
  *
  * @return bool true if successful
  */
 public function getFile($remote_file, $local_file)
 {
     return ssh2_scp_recv($this->session, $remote_file, $local_file);
 }
开发者ID:moccalotto,项目名称:ssh,代码行数:12,代码来源:Session.php


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