|
You need to compile php with the ./configure --with-ftp
I will only show you code of some code hacked together...
Tried to use most of the functions available to PHP
<?
$result = ftp_connect("",21) or die ("Failed to connect to FTP
server");
$connect = ftp_login($result,"username","password") or die("Failed to
login");
$systype = ftp_systype($result);
echo $systype . " Ftp Server<br>\n";
$pwd = ftp_pwd($result);
$_dir = "$pwd/public_html";
/* Make a directory */
// ftp_mkdir($result,$_dir);
ftp_chdir($result,$_dir);
$pwd = ftp_pwd($result);
$a = "/home/username/web/index.html";
$b = "$_dir/index.html";
/* rawlist or inlist */
// ftp_put($result, $b,$a, FTP_BINARY);
$list = ftp_rawlist($result,$pwd);
for($i=0; $i < count($list); $i++) {
echo $list[$i] . " \n";
}
// ftp_rename($result, $b,$a, FTP_BINARY);
// ftp_delete($result, $_dir/$filename);
ftp_quit($result);
?>
>> Comments/FeedBack
|