Koneksi ke FTP dengan PHP


<?PHP

$ftp_server   = "xx.x.xxx.xxx"; #diisi dengan alamat FTP
$ftp_user     = "user"; #diisi dengan username
$ftp_pass     = "password"; #diisi dengan password user

$connect      = ftp_connect($ftp_server);
$ftp_login    = ftp_login($connect,$ftp_user,$ftp_pass);

#mengecek koneksi ke ftp server
if($connect){
echo "Connect to $ftp_server </br>";
}else{
echo "Could not connect $ftp_server</br>";
}

#mengecek login ke ftp server
if($ftp_login){
echo "Connected as $ftp_user@$ftp_server</br>";
}else{
echo "Could not connect as $ftp_user@$ftp_server</br>";
}

ftp_close($connect);
?>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s