hi all,
I am having an issue with a small FTP script I am putting together.
When I run the script I get the following error:
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/vhosts/example.com/httpdocs/xml/planeh.php on line 7
FTP connection has failed!Attempted to connect to ftp.example.com for user myusername
Line 7 starts with: $login_result
My script looks like:
$ftp_server = 'localhost';
$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 connection ID is $conn_id<br/><br/>";
}
ftp_close($conn_id);
Can anyone see what is wrong.