tags:

views:

58

answers:

2

Is it possible to automaticly download xml files from one server to another server on a daily basis with PHP?

The goal is to create a webapplication in CakePHP which makes use of an xml report that comes from a online accountingserver.

So it can be done using a cronjob? But is cron supported with PHP?

Where can i configure that cronjob?

What kind of code should i write to get the file from the accountingserver in the first place?

+4  A: 

Yes, you can create a PHP script that will download the data from the second server and then call it from using a cron job. Cron jobs allow you to run code at specific times. More info on that here.

It would probably look something like this:

0 0 * * * php path/to/file.php

This basically tells it to run file.php at minute 0, hour 0, every day, every month.

Sam152
Or for those of us using Windows, a scheduled task.
Neil Aitken
@Neil Good point.
Sam152
+2  A: 

Surely you can.

You write a PHP program that does this transfer once, when called. Then we run that program automatically every day at a fixed time by setting up a cron job.

codaddict