PHP code example of kasim.yilmaz / sftp-helper

1. Go to this page and download the library: Download kasim.yilmaz/sftp-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kasim.yilmaz / sftp-helper example snippets


$ftp_server = "ftp.ftp.com";
$port = "22";
$username = "username";
$password = "password";
$incomingFolder = "/ftp/folder";
sftp = new SftpHelper($ftp_server,$port, $username,$password,$incomingFolder);


$sftp->open();

if($sftp->status)
{
    echo "Connection Succesful";
}else
{
    throw new Exception("Connection Failed :( ");
};

$sftp->put($folder,$fileName,$fileContent);


$isExist = $sftp->isExist($path);

$folderPath  ="/var/folder/folder";
$isCreated = $sftp->createFolder($folderFullPath);

$folderPath  ="/var/folder/folder";
$arrayOfFileNameList = $sftp->GetAllFileList($folderPath);

$folderPath  ="/var/folder/folder";
$isExist = $sftp->GetFileContents($fileList,$folderPath);