bernardbrink
asked on
Access multiple ftp server to upload one file and quit
Hi,
I'm trying to connect to multiple ftp servers, login, put a file, and close the connection.
I'm 100 % sure the password is correct, because a single connection works fine. HTTP connection also.
I'm only getting a resource_id.
I can't find the problem, you guys have any idea ?
Thanks in advantage
I'm trying to connect to multiple ftp servers, login, put a file, and close the connection.
I'm 100 % sure the password is correct, because a single connection works fine. HTTP connection also.
I'm only getting a resource_id.
I can't find the problem, you guys have any idea ?
Thanks in advantage
<?php
$db = mysql_connect("xxx", "root","xxx")or die("!connect");
mysql_select_db("inv") or die("!db");
$sql = "SELECT address FROM `custom_host_group_members` WHERE group_alias='UPS' ORDER BY display_name";
$array = mysql_query($sql) or die(mysql_error());
while ($result = mysql_fetch_array($array))
{
$user = "admin";
$pass = "geheim.old";
$ip = $result['address'];
echo $conn = ftp_connect($ip);
echo $login = ftp_login($conn,$user,$pass);
echo $write = ftp_put($conn,"config.ini","config.ini",FTP_ASCII);
ftp_close($conn);
}
?>
ASKER
hi shinug,
The echo on ftp_connect give a resource_id, which is correct...right?
and the echo on ftp_login / ftp_write give nothing back.
the echo on ftp_close gives '1'
Any ideas?
The echo on ftp_connect give a resource_id, which is correct...right?
and the echo on ftp_login / ftp_write give nothing back.
the echo on ftp_close gives '1'
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
update the code with the error message
if (ftp_put($conn,"config.ini
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
Hope this helps