<?php  
$hostname = '192.168.2.70';
$username = 'franco';
$password = 'franco1';
$conn_id = ftp_connect($hostname);
$login = ftp_login($conn_id, $username, $password);
$parent_link = './DocumentsPublics';
if (!$conn_id) {
    echo 'Wrong server!';
    exit;
} else if (!$login) {
    echo 'Wrong username/password!';
    exit;
} else {
    $directory = dirToArray($conn_id, $parent_link);
    var_dump($directory);
}

function dirToArray($ftpConnection, $dir) { 

    $result = array(); 

    $cdir = ftp_nlist($ftpConnection, $dir); 
    foreach ($cdir as $key => $value) 
    { 
        $subs_value = substr($value, strlen($dir) + 1);
        // assuming its a folder if there's no dot in the name 
        if (strpos($value, '.') === false) {
            $result[$subs_value] = dirToArray($ftpConnection, $value);
        }
        else
        {
            $result[] = $subs_value;
        }
    } 
    return $result; 
}
?>