I'm trying to connect to an ftp site and list the files and folders (and subfolders) but all I'm getting is an empty array, it connects fine, but I'm getting nothing from the ftp_nlist() function. When I log into the ftp site with FileZilla there's a whole directory structure available, any ideas to why this doesn't work with php?
Code:
<html>
<head>
  <title>Ftp List</title>
</head>
<body>
<?php
function ftpRecursiveFileListing($ftpConnection, $path) {
    static $allFiles = array();
    $contents = ftp_nlist($ftpConnection, $path);

    if (is_array($contents)) {
        foreach($contents as $currentFile) {
            // assuming its a folder if there's no dot in the name 
            if (strpos($currentFile, '.') === false) {
                ftpRecursiveFileListing($ftpConnection, $currentFile);
            }
            $allFiles[$path][] = substr($currentFile, strlen($path) + 1);
        }
    }
    return $allFiles;
}


// connect and login to FTP server
$ftp_server = "<removed for forum post>";
$ftp_userName = "<removed for forum post>";
$ftp_password = "<removed for forum post>";

$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_userName, $ftp_password);

if ($login) {
    // get file list of current directory
    $file_list = ftpRecursiveFileListing($ftp_conn, ".");
    
    if (!empty($file_list)) {
        foreach($file_list as $file) {
            echo("$file<br />");
        }
    } else {
        echo("No directory list");
    }
    
    // close connection
    ftp_close($ftp_conn);
} else
    echo("Login failed on <b>$ftp_server</b> for <b>$ftp_userName</b>");
?>
</body>
</html>
I'm using xampp for coding/testing this, but when I upload it to the GoDaddy PHP webserver it's not working their either.