Esempio n. 1
0
 public function test__instance()
 {
     $ftp = new \FtpClient\FtpClient();
     $this->given($e = new TestedClass())->object($e)->isInstanceOf('\\FtpClient\\FtpException')->isInstanceOf('\\Exception')->exception(function () use($ftp) {
         $ftp->doNotExist();
     })->isInstanceOf('\\FtpClient\\FtpException')->isInstanceOf('\\Exception');
 }
Esempio n. 2
0
 public function ftp_test($id = null)
 {
     $server = $this->Server->findById($id);
     $ftp = new \FtpClient\FtpClient();
     $ftp->connect($server['Server']['host']);
     $ftp->login($server['Server']['username'], $server['Server']['password']);
     $ftp->pasv(true);
     $ftp->rmdir('/www/blabla', true);
 }
<?php

$ftp = new \FtpClient\FtpClient();
$ftp->connect('host');
$ftp->login('user', 'pwd');
var_dump($ftp->scanDir('.'));
Esempio n. 4
0
 /**
  * Ftp Dosya Aktarımı
  *
  * @param $local string Yerel Dizin
  * @param $remote string Hedef Dizin
  *
  * @return array status,mesaj,detail
  */
 public function ftp($local, $remote)
 {
     try {
         $ftp = new FtpClient\FtpClient();
         $ftp->connect($this->host);
         $ftp->login($this->ftp[0], $this->ftp[1]);
         $this->messages(array('status' => 'info', 'mesaj' => 'File transfer started..'));
         $ftp->putAll($local, $remote, FTP_BINARY);
     } catch (\Exception $e) {
         return array('status' => 'failure', 'mesaj' => 'Ftp : ' . $e->getMessage());
     }
     return array('status' => 'info', 'mesaj' => 'File transfer finished');
 }