Skip to content

Commit 0504d95

Browse files
authored
Merge pull request #63 from harishanchu/master
Merge v2 changes to master
2 parents bb9d1b0 + cfd769e commit 0504d95

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Config::set('ftp.connections.key', array(
3838
'username' => '',
3939
'password' => '',
4040
'passive' => false,
41+
'secure' => false,
4142
));
4243
```
4344

src/Anchu/Ftp/Ftp.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ public function connect($config)
4242
$config['port'] = 21;
4343
if(!isset($config['timeout']))
4444
$config['timeout'] = 90;
45+
if (!isset($config['secure']))
46+
$config['secure'] = false;
4547

46-
$connectionId = ftp_connect($config['host'],$config['port'],$config['timeout']);
48+
if ($config['secure']) {
49+
$connectionId = ftp_ssl_connect($config['host'], $config['port'], $config['timeout']);
50+
} else {
51+
$connectionId = ftp_connect($config['host'], $config['port'], $config['timeout']);
52+
}
4753
if ($connectionId) {
4854
$loginResponse = ftp_login($connectionId, $config['username'], $config['password']);
4955
ftp_pasv($connectionId, $config['passive']);

src/config/config.php

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'username' => '',
3131
'password' => '',
3232
'passive' => false,
33+
'secure' => false
3334
),
3435
),
3536
);

0 commit comments

Comments
 (0)