<PRE><?
// !!! Warnning this example with recursive indexing of FTP directory can spend 1-2 minutes due low network speed.
require 'adv_ftp.php';
$ftp = new adv_ftp();
$ftp->level=1; // set recursive level to 1
$ftp->conn('mirrors.kernel.org', 'Anonymous', 'phpclasses@adv-ftp'); // connect for FTP
$ftp->changeDir("/slackware/slackware"); // set directory
//$ftp->listFiles(); // classic dir directory
$ftp->recursive(FALSE,0); // recursive dir ditrectory
// create sample URL with FTP syntax ftp://user:password@host:port/path
echo "<table border=1><tr><th>File Name</th><th>Size</th><th>Unix Date</th></tr>";
foreach ($ftp->dir as $file=>$key){
// print_r ($key);
$url="ftp://".$ftp->username.":".$ftp->password."@".$ftp->hostname."/".$key[dir]."/".$key[filename];
echo "<tr><td><a href='".$url."'>".$url."</A></td><td>".$key[size]."</td><td>".$key[date]."</td></tr>\r\n";
} // foreach ftp
echo "</table>";
// print_R ($ftp->dir); // list class library
|