FTP
| From: | Kit | Date: | Sat, 19 Aug 2000 02:20:30 +0000 |
| Subject: | FTP | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-1986@lists.php.net to get a copy of this message | ||
Here is my code to connect ftp.
but it only work when I connect local host
Why? Any solution to connect other host? can i use IP instead of host name?
I am using php-4.0.1pl2-Win32 + IIS4
<?php
$list = Array();
$user = "sa";
$password="";
$ftp = ftp_connect("$host");
if (!$ftp)
echo "Error: Ftp connection has failed!\r\n<br>";
die;
}
echo "Connected! [ID: $ftp]\r\nAttempting logon...\r\n<br>";
if (!ftp_login($ftp,"$user","$password")){
echo "Error: Ftp logon for user [$user] has failed!\r\n<br>";
die;
}
echo "User [$user] logged in successfuly!\r\n\r\n<br>";
$dir = ftp_pwd($ftp);
$list = ftp_nlist($ftp,"$dir");
echo "Local Dir: $dir<br><br>";
$i=0;
echo "$i. $list[$i]<br>";
$i++;
}while($list[$i]);
$logout = ftp_quit($ftp);
?>