unable to connect ftp account with ftp_connect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
heaven.bd
Forum Newbie
Posts: 1
Joined: Wed Jun 17, 2009 1:53 am

unable to connect ftp account with ftp_connect

Post by heaven.bd »

hi,
i am using php 5.2 on windows. i am want to connect an ftp account with php. my code is

<?php
$ftp_server = "ftp://dropbox.moteng.com";
$ftp_user_name = "username";
$ftp_user_pass ="password";

$conn_id = ftp_connect($ftp_server);

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}

ftp_close($conn_id);
?>

but i am getting the error:
Warning: ftp_connect() [function.ftp-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known.

but i can connect the ftp account with browser mozila and ie7, also with cuteftp.

please help me
Post Reply