Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: user
- * Date: 14.09.18
- * Time: 16:16
- */
- namespace app\commands;
- use yii\console\Controller;
- class DownloadController extends Controller
- {
- public function actionDownload()
- {
- $local_file = __DIR__ . '/modules/sokolov.data.json';
- $server_file = 'ftp://box_sokolov@ftp.ucann.ru/sokolov.data.json';
- $ftp_server = 'box_sokolov@ftp.ucann.ru';
- $ftp_user_name = 'box_sokolov';
- $ftp_user_pass = 'ww1zbdx1';
- $conn_id = ftp_connect($ftp_server);
- if (ftp_login($conn_id, $ftp_user_name, $ftp_user_pass)) {
- if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
- echo 'Файл сохранен в' . $local_file;
- } else {
- echo 'Ошибка';
- }
- }
- ftp_close($conn_id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement