SFTP not supported error with PHP & cURL SFTP not supported error with PHP & cURL curl curl

SFTP not supported error with PHP & cURL


Maybe try using phpseclib, a pure PHP SFTP implementation. eg.

<?phpinclude('Net/SFTP.php');$sftp = new Net_SFTP('www.domain.tld');if (!$sftp->login('username', 'password')) {    exit('Login Failed');}// puts a three-byte file named filename.remote on the SFTP server$sftp->put('filename.remote', 'xxx');?>


As of this writing, there is no longer a need to depend on and use curl's sftp implementation if you have access to php. Goto php.net and look at ssh2 support. There you will find an how to deploy sftp programmatically.

An alternative, still in php, is to use the Net_SFTP class/package to found at phpseclib.sourceforge.net.

The documentation is at http://phpseclib.sourceforge.net/documentation/net.html#net_sftp.

Expect?

In the unlikely event that you don't have access to php or you don't want to use php, I suggest that you can still stop worrying about curl's sftp implementation by using expect. If you do not already have expect on your system, goto www.nist.gov/el/msid/expect.cfm to get it. Once you get it and install it, then to scripting sftp will look something similar to

#!/usr/bin/expectspawn /usr/bin/sftp <user@hostname>expect "password:"send "<mypassword>\r"expect "sftp> "send "get <remotefile> \r"expect "sftp> "send "bye \r"exit 0

where you will replace with your own values.

The idea is to stop wasting time on trying to use sftp with curl. You can use php's implementation or you can script sftp using expect. Hope this helps and saves someone from wasting time.