Login   Register  
PHP Classes
elePHPant
Icontem

File: example1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tomasz Malewski  >  ADV_FTP  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: Example 1
Class: ADV_FTP
List the files in a FTP server recursively
Author: By
Last change: make public
Date: 3 years ago
Size: 791 bytes
 

Contents

Class file image Download
<PRE><?


require 'adv_ftp.php';
$ftp = new adv_ftp();
$ftp->conn('mirrors.kernel.org''Anonymous''phpclasses@adv-ftp');        // connect for FTP
$ftp->changeDir("/slackware");                            // set directory
$ftp->listFiles();                                // classic dir directory

// 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

exit;