On localhost
I tried to get the ftp file from server and the local file is successfully created. But when I'm trying in Ubuntu server it's displaying there was a problem and file is not downloading into server. Here is the code . And code file created in this location /var/www/html/
:
<?php
// define some variables
$local_file = 'local.csv';
$server_file = 'serverfile.csv';
$ftp_server="ip address";
$conn_id = ftp_connect($ftp_server)or die("Couldn't connect to $ftp_server");
$ftp_user_name="user anme";
$ftp_user_pass="pass";
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n";
}
} else {
echo "There was a problem\n";
}
ftp_close($conn_id);
?>
Please help me to solve this issue, in local host it's working fine but in Ubuntu server local file not creating/downloading.
error_get_last()
?