Forum Moderators: coopster

Message Too Old, No Replies

unable to connect ftp account with ftp connect PostPost

         

heavenbd

10:50 am on Jun 17, 2009 (gmt 0)

10+ Year Member



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.example.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

[edited by: coopster at 12:29 pm (utc) on June 17, 2009]
[edit reason] please use example.com, thanks! [/edit]

coopster

12:33 pm on Jun 17, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, heavenbd.

Are you running a firewall and if so, is it blocking your connection?