I\'m trying to download a file from an ftp server using curl and php but I can\'t find any documentation to help
$curl = curl_init();
curl_setopt($curl, CURL
$ftp_location = put your ftp adress here;
$location_login = put your login here;
$location_pwd = put your password here;
$conn_id = ftp_connect("$ftp_location");
$login_result = ftp_login($conn_id, $location_login, $location_pwd);
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
exit;
} else {
echo "Connected";
}
// get the file
// change products.csv to the file you want
$local = fopen("products.csv","w");
$result = ftp_fget($conn_id, $local,"products.csv", FTP_BINARY);
fwrite($local, $result); fclose($local);
// check upload status
if (!$result) {
echo "FTP download has failed!";
} else {
echo "Downloaded ";
}
// close the FTP stream
ftp_close($conn_id);