Hello, I am new here but I hope you can help me with a problem that I've been stuck with for days.
I am trying to populate the content of a website through XML files (zipped) that are located on an FTP server.
I managed to get the zip file but I'm not sure if it is the correct way:
function ftp_copy($file) {
$conn_id = ftp_connect($ftp_host) or die ("Can't connect");
$ftp_login= ftp_login($conn_id, $ftp_user, $ftp_pass) or die ("Can't login");
ftp_pasv($conn_id, true);
ftp_chdir($conn_id, "/zip_files/");
return ftp_get($conn_id, $file, $file, FTP_BINARY);
}
ftp_copy('1001.zip');
After that I will need to extract the zip file. I'm planning to use pclzip library for it and save the contents on a database.
Also this has to happen everyday so I'm thinking about using a cron job, although hourly is also preferable since the XML files could be generated more than once per day.
Am I doing it the right way or is there a better solution for this?
Any help will me much appreciated! Thanks a lot!