PHP code example of sebastianfeldmann / ftp

1. Go to this page and download the library: Download sebastianfeldmann/ftp 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/ */

    

sebastianfeldmann / ftp example snippets


$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:[email protected]');
foreach ($ftp->ls() as $item) {
    echo $item->getFilename() . PHP_EOL;
}

$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:[email protected]');
foreach ($ftp->lsDirs() as $item) {
    echo $item->getFilename() . PHP_EOL;
}

$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:[email protected]');
foreach ($ftp->lsFiles() as $item) {
    echo $item->getFilename() . PHP_EOL;
}

$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:[email protected]');
$ftp->uploadFile($pathToLocalFile, 'foo/bar/baz', 'filname.zip');