l0ve2hat3 Posted August 20, 2008 Share Posted August 20, 2008 I am trying to list and download files from a remote server that only accepts SFTP not FTPS (they are different... google it) so ftp_ssl_connect() will not work for me. now is it possible to connect via exec using the sftp command? if so how? Link to comment https://forums.phpfreaks.com/topic/120569-sftp-via-exec/ Share on other sites More sharing options...
l0ve2hat3 Posted August 20, 2008 Author Share Posted August 20, 2008 well thanks for all the help! i founnd my solution: <?php $server = "0.0.0.0"; //valid IP $username = "username"; //valid User Name $password = "Password"; //valid Password $connection = ssh2_connect($server, 22); // use any of the ssh2_auth_* methods ssh2_auth_password($connection,$username, $password); $sftp = ssh2_sftp($connection); $dir = "ssh2.sftp://$sftp/a/"; $dh = opendir($dir); while (false !== ($file = readdir($dh))){ echo "$file <br>"; } closedir($dh); ?> Link to comment https://forums.phpfreaks.com/topic/120569-sftp-via-exec/#findComment-621465 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.