public static function getFiles() { $host = "localhost"; $ftp = new FtpClient(); $ftp->connect($host); $ftp->login("ftp", "ftp"); $remote_file = "techchar_values_assignment.xml"; $local_file = Yii::getAlias('@app') . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . "techchar_values_assignment.xml"; $ftp->get($local_file, $remote_file, $mode = FTP_ASCII); self::parse($local_file); }
public static function getFiles() { $host = Yii::$app->params['ftp']['host']; $name = Yii::$app->params['ftp']['name']; $pass = Yii::$app->params['ftp']['pass']; $ftp = new FtpClient(); $ftp->connect($host); $ftp->login($name, $pass); $remote_file = Yii::getAlias('@ftpXml') . DIRECTORY_SEPARATOR . "properties.xml"; $local_file = Yii::getAlias('@localXml') . DIRECTORY_SEPARATOR . "properties.xml"; $ftp->get($local_file, $remote_file, $mode = FTP_ASCII); self::parseValues($local_file); }
public static function getImages() { $host = Yii::$app->params['ftp']['host']; $name = Yii::$app->params['ftp']['name']; $pass = Yii::$app->params['ftp']['pass']; $ftp = new FtpClient(); $ftp->connect($host); $ftp->login($name, $pass); $files = $ftp->scanDir(Yii::getAlias('@ftpProductsImg')); foreach ($files as $file) { $local_file = Yii::getAlias('@localProductsImg') . DIRECTORY_SEPARATOR . $file['name']; $remote_file = Yii::getAlias('@ftpProductsImg') . DIRECTORY_SEPARATOR . $file['name']; $ftp->get($local_file, $remote_file, $mode = FTP_ASCII); } }