I'm in the process of building an web app that will, besides other things, need to connect to a FTP server to download or upload files. The application is written in PHP and it's hosted on a Linux server.
What I was wondering is whether or not it would be possible to also provide support for SFTP servers, but after some quick searches on Google it seems that this is not all that simple.
So, the question is: What would be the best way to use SFTP from within PHP? Is there a class that could also provide support for FTP as well as SFTP so that same functions could be used for both?
CURLOPT_PROTOCOLS
. You can just putsftp://
at the front of the hostname you pass withCURLOPT_URL
and cURL will automatically detect and use SFTP. – Bimetallic