CodeIgniter Forums

Full Version: Continuous XML fetching...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hi,
I have just started using code igniter, and I am already getting on very well with it, due to my past experience in a wide array of languages!
There is one thing I don't know how to go about doing, both with code igniter and in PHP.

I simply want to fetch an XML file every xx seconds, which will in my case then input the data from the XML into a database.
I don't know if there is a main loop, or where should I make one. I have no idea how to go about this!
Any suggestions will be appreciated! Thanks

El Forum

[eluser]Kemik[/eluser]
Use a cron job?

El Forum

[eluser]bradym[/eluser]
There is no main loop in PHP. As an interpreted language, a PHP script only runs until it finishes the task. It doesn't keep running indefinitely. You'll need to setup a cron job (if you're on a *nix system) or a scheduled task (if you're on a windows system).

Brady

El Forum

[eluser]Symcrapico[/eluser]
What about an AJAX call into a setTimeout?

El Forum

[eluser]GSV Sleeper Service[/eluser]
cron is the way to go. this didn't really need saying, but I needed an excuse to comment on Symcrapico's avatar! Bob Ross was da man! RIP Bob