Hello guys
i am using this script to download a file from a server
<?
// set up variables - change these to suit application
$host = "hhhhh.com";
$user = "username";
$pass = "xxxxxx";
$remotefile = "$DOCUMENT_ROOT/test/test.txt";
// connect to host
$conn = ftp_connect("$host");
if (!$conn)
{
echo "Error: Could not connect to ftp server<br>";
exit;
}
echo "Connected to $host.<br>";
// log in to host
$result = ftp_login($conn, $user, $pass);
if (!$result)
{
echo "Error: Could not log on as $user<br>";
ftp_quit($conn);
exit;
}
echo "Logged in as $user<br>";
// download file
echo "Getting file from server...<br>";
if (!$success = ftp_get($conn, "C:/test.txt", $remotefile, FTP_BINARY))
{
echo "Error: Could not download file";
ftp_quit($conn);
exit;
}
fclose($fp);
echo "File downloaded successfully";
// close connection to host
ftp_quit($conn);
?>
when i run this script i got this kind of warning:
Warning: error opening C:/test.txt in /var/www/hhhhh/html/test/test.txt on line 67
Error: Could not download file
Does someone know why or knows how can i download a file using FTP or another solution thank you
Dany Namroud