Hello everyone.
I am having some trouble logging into a secure ftp server where I am downloading a zip file onto my server. When use this script to login to one of my servers, it works just fine. When I change the data to login to a site I pull data from, I get a timeout error that reads "the server unexpectedly dropped the connection". Here is the script I am using:
<?php
//grab data
$ftp_server = "ftpserver.com";
$ftp_user_name = "username";
$ftp_user_pass = "password";
$local_file = 'local_file';
$server_file = 'server_file';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n$server_file";
} else {
echo "There was a problem\n";
}
// close the connection
ftp_close($conn_id);
?>
If anybody can help me with any input it would greatly be appreciated. I am having a hard time figuring out why it works on one server but not another.
Thanks in advance.