I have bunch of files which I need to upload to different sftp servers. How i can achieve this quickly using PHP? any help on this appreciated. Thanks in advance
You will need the ssh2
extension for PHP.
Then, make a connection to SSH with it and then open SFTP. Here is the 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://' . intval($sftp) . '/path/to/file', 'r');
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.