I'm trying to set up ftp on my website. I can successfully log in, put, get, change directories using an ftp client. When I try to ftp on my website from within the server, I get this error;
Warning: php_hostconnect: connect failed in uploadpics.php on line 3
and here's the code I'm using
<?php
//set up basic connection
$conn_id = ftp_connect("localhost");
// login with username and password
$login_result = ftp_login($conn_id, "site", "pword"); //line 3
// check connection
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";
}
?>
should I be using an IP, the full url, or should it be localhost? Could the server be blocking all attempts to login from within the server"