How can I run this ftp_get script?

41 views Asked by At

I can run PHP scripts using a browser and a VPS I have through Ionos. There is one script, however, that I don't know how to run. It uses the ftp_get command to download a file from my server and place the file on my pc. I presume there has to be some interface between the program running the script and my pc. This is the code

<?php

include 'include/helper.php';

// connect to FTP server and login
$ftp_server = $server_address;
$ftp_username = $user;
$ftp_userpass = $pass;

$ftp_conn = ftp_connect($ftp_server) or die ('Could not connect to FTP server');
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);

// download FTP server file
$local_file = 'local.csv';
$server_file = 'invenfeed_5264.csv';

if (ftp_get($ftp_conn, $local_file, $server_file)){
    echo "Successfully downloaded file";
} else {
    echo "Error downloading file from FTP server";
}
// Close the FTP connection
ftp_close($ftp_conn);
?>

I tried setting up Powershell ISE but don't know enough about Powershell yet to execute the script

0

There are 0 answers