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
<?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); 
}


?>

Open in new window

LVL 5
bernardbrinkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shinesh PremrajanEngineering ManagerCommented:
there could be a user permission error.

update the code with the error message

if (ftp_put($conn,"config.ini","config.ini",FTP_ASCII)) {
 echo "successfully uploaded $file\n";
} else {
 echo "There was a problem while uploading $file\n";
}


Hope this helps
0
bernardbrinkAuthor Commented:
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?
0
bernardbrinkAuthor Commented:
Too bad, It wasn't a script problem after all.
The login took too long, because the ups(ses) check the RADIUS server first.
Thank you anyway for thinking with me.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.