0
I have this code I wanted to connect to ftp
. Through the browser I can, but the code tells me you can’t log in.
Follow the code, I hid the data:
$ftp_server = "" ;
$ftp_user_name = "" ;
$ftp_user_pass = "" ;
$depth = 10;
$conn_id = ftp_connect($ftp_server) ;
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (!$login_result) { die("Couldn't log in to FTP account."); }
$dir = array(".");
$a = count($dir);
$i = 0;
while (($a != $b) && ($i < $depth)) {
$i++;
$a = count($dir) ;
foreach ($dir as $d) {
$ftp_dir = $d."/" ;
$newdir = ftp_nlist($conn_id, $ftp_dir);
foreach ($newdir as $key => $x) {
if ((strpos($x,".")) || (strpos($x,".") === 0)) { unset($newdir[$key]); }
elseif (!in_array($x,$dir)) { $dir[] = $x ; }
}
}
$b = count($dir) ;
}
print_r($dir) ;
ftp_close($conn_id);
?>
well the point is that I have several directories...I wanted to list and download...never used this class
– usersantos