Jump to content

Running an automatic schedule task in PHP.


theITvideos

Recommended Posts

Hi there,

 

I am working on a php project on my WAMP server where I have access to XML datafeed from xe.com once a day to get the Exchange rates. This xml datafeed is saved on my localhost as an archived copy.

 

Now I would like to automatically access the fresh xml datafeed file from xe.com once a day and replace (or update) the xml file on my localhost to have the updated information (rates).

 

How can I schedule this task automatically and make php access the updated xml file once a day.

 

All comments and feedbacks are always welcomed :)

 

Thank you!

Link to comment
Share on other sites

You need to use the OS's scheduler program. In the case, Windows Scheduler on Linux you would use Cron.

 

This really has nothing to do with PHP.

 

Glad to hear from you.

 

So now I have tried my hands on windows scheduler. I can created a simple task that just displays a test msg (just to see if it is working.)

 

Now how do I write a php script that will get the updated xml data from a link i.e:

 

http://mydomain.com/TheUpdatedxmlFile.xml

 

and update the old xml file residing on my localhost.

 

And once I can get the update script, then in the Windows Scheduler I can set it to 'once a day' coz I am allowed to access the new xml file only once in a day.

 

Now i can take care of the scheduling part, it is just the php script (or code) that I need that will automate the process of getting the updated xml file. (Basically to replace the old xml file with the new one from the link)

 

Please reply. :)

 

Thank you!

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.