自动文件传输(每日) [英] Automatic file transfer (daily)
问题描述
是否可以每天使用PHP从一个服务器自动将XML文件下载到另一个服务器?
目标是在CakePHP中创建一个web应用程序,使用来自在线帐户服务器的xml报告。
所以可以使用cronjob来完成这个任务吗?但是cron是否支持PHP?
在哪里可以配置cronjob?
$ p
是的,您可以创建一个PHP脚本,数据从第二个服务器,然后使用cron作业调用它。 Cron作业允许您在特定时间运行代码。有关此处的详情。
它可能看起来像这样:
0 0 * * * php path / to / file.php
这基本上告诉它在分钟0,小时0,每天,每月运行file.php。
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?
解决方案 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.
这篇关于自动文件传输(每日)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!