-1

a quick question, currently im using this line to scan file in other site "$sfs = scandir('ftp://'" but i was wondering what if the site is using SFTP - SSH, should i still use the command below but instead of ftp i'll use sftp? "$sfs = scandir('sftp://'""

I will really appreciate your answer. thanks!

Liyo
  • 19
  • 2
  • 7

1 Answers1

-1

SFTP has a COMPLETE guide at This page.

You should make a connection first and then you can tansfer files.

(copy the stream variable in example below at your own direction.

create a new file by fopen and then print the $stream in the new file)

example from php.net:

<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$sftp = ssh2_sftp($connection);

$stream = fopen("ssh2.sftp://$sftp/path/to/file", 'r');
?>
Leo
  • 867
  • 1
  • 15
  • 41