0

I know there is a default FTP Library Class, but it doesn't work with SFTP

neubert
  • 14,976
  • 22
  • 102
  • 184
Shamoon
  • 38,429
  • 77
  • 269
  • 518

3 Answers3

4

Personally, I'd recommend phpseclib, a pure PHP SFTP implementation. It has no external dependancies, unlike the PHP ssh2 library extension Femi recommended and it's a ton more versatile than cURL.

neubert
  • 14,976
  • 22
  • 102
  • 184
3

If you download phpseclib, you can put it in the third_party folder and create a simple library using :

    set_include_path(APPPATH . '/third_party/phpsec');
require_once APPPATH."/third_party/phpsec/Net/SFTP.php"; 
class Sftp {  }

Which then it's just like all other libraries that you can use wherever in your Codeigniter app.

eric.itzhak
  • 15,252
  • 26
  • 85
  • 139
0

Take a look at http://codeigniter.com/forums/viewthread/156139/. It uses the PHP ssh2 library extension (see http://www.php.net/manual/en/function.ssh2-sftp.php, with the overview at http://www.php.net/manual/en/book.ssh2.php).

Or do it with cURL: previously mentioned at SFTP from within PHP.

But no, there is no CI class library that does SFTP.

Community
  • 1
  • 1
Femi
  • 63,688
  • 8
  • 117
  • 146