Retrive an xml file from mail or ftp?

#1

Hello,

There is this company that does not have an API for their data. Instead they can send the data to me thru mail or FTP. I have no idea how to retive the data from any of this with a php cron job every week or so. Could somone please tell me what would be the easiest to use?

#2

if they can send it to your ftp server then all you need to do is read the file

1 Like
#3

It’s called ETL processing. So, can you parse the file currently?

The next step is to just have a cron script running to move the file to a new location and process it. You move it so that it doesn’t get reprocessed accidentally.

1 Like
#4

Thank you guys

@JimL Is that how it works? Someone told me that hey might have a ftp-server where they upload the data to. Then i somehow have to acess their server and download the data. Would be better if they do as you say, send it to my ftp-server but how do I know which approach they are using?

@astonecipher sounds easy. I currently dont have the file so i dont know what it looks like but its xml so it shouldnt be to hard to parse it

#5

https://www.php.net/manual/en/function.ssh2-scp-recv.php

That’s how to get the file. Then, you just follow the other steps to process it.

#6

I don’t know, you said they could send it via ftp. If they meant make it available on ftp that is something different.

That is also a possibility. Quite easy to do as well. php even has functions ready for it
https://www.php.net/manual/en/function.ftp-get.php

or you can use one of many packages on packagist
https://packagist.org/packages/rjkip/ftp-php

ask them :slight_smile:

#7

Thank you guys! Ill return if I encounter any problems with this