0

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

neubert
  • 15,947
  • 24
  • 120
  • 212
Shamoon
  • 41,293
  • 91
  • 306
  • 570

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
  • 15,947
  • 24
  • 120
  • 212
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,752
  • 26
  • 89
  • 142
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
  • 64,273
  • 8
  • 118
  • 148