I'm trying to connect to a remote server with the simple script supplied on php.net. I can make connection OK, but file is not transferred. I get the following output:
PHP Warning: ftp_get(): Port command successful
I have checked permissions and they look good. I even went so far as to chmod 777 the local directory I'm trying to write to. Here's the script I'm using -- any help or guidance is greatly appreciated:
<?php
// define some variables
$local_file = 'my_file.txt';
$server_file = 'my_remote_file.txt';
$ftp_server='my valid IP address';
// 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_ASCII)) {
echo "Successfully written to $local_file\n";
} else {
echo "There was a problem\n";
}
// close the connection
ftp_close($conn_id);
?>